Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 1 year, 7 months ago. Active 3 months ago. Viewed 3k times. Router ; router. Add a comment. Active Oldest Votes.
Give this code a go. As an example below, using the value gzip , a file can be uploaded as a gzip file - and when it is downloaded, the browser will uncompress it automatically. You may also use a function as the contentEncoding , which should be of the form function req, file, cb.
Skip to content. Star Branches Tags. Could not load branches. Could not load tags. Latest commit. Git stats 97 commits. Failed to load latest commit information. Existing solutions I found required buffering the multipart uploads into the actual filesystem which is difficult to scale. ACL values can be set by passing an optional acl parameter into the multerS3 object. The metadata option is a callback that accepts the request and file, and returns a metadata object to be saved to S3.
Here is an example that stores all fields in the request body as metadata, and uses an id param as the key:. You can pass either a string or a function that returns a string.
If you want multer-s3 to automatically find the content-type of the file, use the multerS3. Here is an example that will detect the content type of the file being uploaded. You may also use a function as the contentType , which should be of the form function req, file, cb. How we can get the s3 url where we upload the file. I tried this code and i got a error like "Error: Unexpected end of multipart data" i dont know why i was searching for solution for couple of days please help me — Anns Rahim.
Show 4 more comments. V31 has answered very well still I want to add my 2 cents. I have created a file for uploading upload. Router ; apiRoutes. Can you please post the details of the request and body that has to be called from Angular front end or from postman client?
Satyam Please check attachment screenshot for post body in Postman — Anjum Hi, can you please have a look at my question here, would really appreciate the help.
The file URL will be in req. V31 V31 7, 3 3 gold badges 24 24 silver badges 44 44 bronze badges. Where to provide the accesskeyId for above — mBlaze. If yes then please mark the answer accepted. Hassan Masood Hassan Masood 29 2 2 bronze badges. Akshay Mistry Akshay Mistry 39 1 1 bronze badge.
0コメント