Reputation: 61
Hi I am using cURL command to upload a file which is a POST request to my local machine service.
I am using following commands to upload
curl -i -X POST -H "Content-Type: multipart/form-data" -F "/Users/myName/Folder/file.csv" http://localhost:port/api/fileupload
In my application side I am using spring frameworks web binding to receive the file
Following is the code snippet
public ResponseEntity importDimensions(@RequestBody MultipartFile file) {
// file is variable is always null
}
What am I missing here?
Upvotes: 0
Views: 3698
Reputation: 88235
You need an @
sign before the filename, like this: @/Users/myName/Folder/file.csv
.
And if your server-side code is expecting a parameter named file
then you need to do this:
-F "file=@/Users/myName/Folder/file.csv"
Upvotes: 1