I am working in angular 2 project. Back-end developers opened me a bug but I don't know what to do. Here is the steps and details:
1- I create a file named 1.txt and inside the file is just 1.
2- I upload this file to the server via https://github.com/valor-software/ng2-file-upload this package
3- Then I ask to server to give me the files list and I click 1.txt to download.
4- When download finished I see these lines inside the 1.txt:
------WebKitFormBoundaryt97WFszMgfTbTJJm
Content-Disposition: form-data; name="file"; filename="11.txt"
Content-Type: text/plain
1
------WebKitFormBoundaryt97WFszMgfTbTJJm--
I just want to see 1. This result corrupts other files too like png, docx etc.
So, the back-end developers said to me that: While file is uploading, JS library shouldn't change the binary file content.
But I can't see any settings to do that. What should I say to them?
P.S. Back-end developers are far away from me and their project written in Java.
The library you are using will, by default, generate a multipart request body.
This is normal. This is standard. This is what would happen if you used a regular (JavaScript-free) form submission to POST a file. This is how most server side systems expect files to be sent over HTTP.
You could tell that to write their code to expect the data in that format.
Alternatively you could look at the documentation for your library which says:
disableMultipart - If 'true', disable using a multipart form for file upload and instead stream the file. Some APIs (e.g. Amazon S3) may expect the file to be streamed rather than sent via a form. Defaults to false.
… and turn that option on.