uncomment the code (#2362)
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							235898e642
						
					
				
				
					commit
					82b284fd77
				
			@ -357,14 +357,14 @@ References issue [#774](https://github.com/gin-gonic/gin/issues/774) and detail
 | 
			
		||||
func main() {
 | 
			
		||||
	router := gin.Default()
 | 
			
		||||
	// Set a lower memory limit for multipart forms (default is 32 MiB)
 | 
			
		||||
	// router.MaxMultipartMemory = 8 << 20  // 8 MiB
 | 
			
		||||
	router.MaxMultipartMemory = 8 << 20  // 8 MiB
 | 
			
		||||
	router.POST("/upload", func(c *gin.Context) {
 | 
			
		||||
		// single file
 | 
			
		||||
		file, _ := c.FormFile("file")
 | 
			
		||||
		log.Println(file.Filename)
 | 
			
		||||
 | 
			
		||||
		// Upload the file to specific dst.
 | 
			
		||||
		// c.SaveUploadedFile(file, dst)
 | 
			
		||||
		c.SaveUploadedFile(file, dst)
 | 
			
		||||
 | 
			
		||||
		c.String(http.StatusOK, fmt.Sprintf("'%s' uploaded!", file.Filename))
 | 
			
		||||
	})
 | 
			
		||||
@ -388,7 +388,7 @@ See the detail [example code](https://github.com/gin-gonic/examples/tree/master/
 | 
			
		||||
func main() {
 | 
			
		||||
	router := gin.Default()
 | 
			
		||||
	// Set a lower memory limit for multipart forms (default is 32 MiB)
 | 
			
		||||
	// router.MaxMultipartMemory = 8 << 20  // 8 MiB
 | 
			
		||||
	router.MaxMultipartMemory = 8 << 20  // 8 MiB
 | 
			
		||||
	router.POST("/upload", func(c *gin.Context) {
 | 
			
		||||
		// Multipart form
 | 
			
		||||
		form, _ := c.MultipartForm()
 | 
			
		||||
@ -398,7 +398,7 @@ func main() {
 | 
			
		||||
			log.Println(file.Filename)
 | 
			
		||||
 | 
			
		||||
			// Upload the file to specific dst.
 | 
			
		||||
			// c.SaveUploadedFile(file, dst)
 | 
			
		||||
			c.SaveUploadedFile(file, dst)
 | 
			
		||||
		}
 | 
			
		||||
		c.String(http.StatusOK, fmt.Sprintf("%d files uploaded!", len(files)))
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user