I'm using axios to send a file over to Digital Ocean Spaces (think S3). I use a presigned URL and the put method to send the file over. The problem is, when the file arrives, the contents are wrapped with header information and some integer at the top and bottom of the request body. I can download the file from Spaces and the downloaded copy has the header text. I want the file to arrive "pure" without any headers.
I pasted below:
<input type="file" onChange={(e) => setUploadFile(e.target.files)} />
const dataArray = new FormData();
dataArray.append("upload", uploadFile[0]);
axios.put(url, dataArray, {
}).then((response) => {
axios.post(`/files/${file_id}/uploaded_to_cloud`).then((response) => {
}).catch((error) => {
})
}).catch((error) => {
// error response
});
-----------------------------131213519412411207592735141314
Content-Disposition: form-data; name="upload"; filename="tasks.txt"
Content-Type: text/plain
from config.config import is_async
import json
import uuid
from flask import request
-----------------------------131213519412411207592735141314--
I don't have an answer to the question, however here's what I did that ended up working.
const xhr = new XMLHttpRequest();
xhr.open('PUT', url);
xhr.send(file);