// createFormFile reads defined files and adds to form
createFormFile reads defined files and adds to form
// createFormFile reads defined files and adds to form
func createFormFile(w *multipart.Writer, key, value string) error {
	part, err := w.CreateFormFile(key, value)
	if err != nil {
		logger.Errorf("Failed to create form data from file %v Error: %v", value, err)
		return err
	}
	f, err := os.Open(value)
	if err != nil {
		logger.Errorf("Failed to open file %s Error: %v", value, err)
		return err
	}
	defer func() {
		if err = f.Close(); err != nil {
			logger.Errorf("Failed to close file %s Error: %v", value, err)
		}
	}()
	_, err = io.Copy(part, f)
	if err != nil {
		logger.Errorf("Can't copy file %s Error: %v", value, err)
		return err
	}
	return nil
}
func createFormFile ( w * multipart . Writer , key , value string ) error { part , err := w . CreateFormFile ( key , value ) if err != nil { logger . Errorf ( " " , value , err ) return err } f , err := os . Open ( value ) if err != nil { logger . Errorf ( " " , value , err ) return err } defer func ( ) { if err = f . Close ( ) ; err != nil { logger . Errorf ( " " , value , err ) } } ( ) _ , err = io . Copy ( part , f ) if err != nil { logger . Errorf ( " " , value , err ) return err } return nil }
createFormFile reads defined files and adds to form
createFormFile reads defined files and adds to form