Upload files

Upload a file

You can upload files using the Dropzone.

Upload a file Upload a file

Here you can either drag & drop files or you click the Dropzone and select one or more from the file dialog. The upload will begin right away and the file will be uploaded to the directory you are in.

Upload using curl

You can also upload files from the command line, for example using curl.

curl -X POST "http://127.0.0.1:8000/upload" -F files=@test.txt

In addition here are two POST requests, how a file upload request would look like.

POST /upload HTTP/1.1
Host: 192.168.1.1:8000
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:107.0) Gecko/20100101 Firefox/107.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cache-Control: no-cache
X-Requested-With: XMLHttpRequest
Content-Type: multipart/form-data; boundary=---------------------------209503793532215053971826165259
Content-Length: 862522
Origin: http://192.168.1.1:8000
Connection: close
Referer: http://192.168.1.1:8000/

-----------------------------209503793532215053971826165259
Content-Disposition: form-data; name="files[0]"; filename="dall-e-2-cat-hacker-2_small.jpg"
Content-Type: image/jpeg

ÿØÿàJFIFHHÿá:nExifII*bj(1
r2€i[...snip...]
-----------------------------209503793532215053971826165259--


POST /upload HTTP/1.1
Host: 192.168.1.1:8000
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:107.0) Gecko/20100101 Firefox/107.0
Accept: application/json
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cache-Control: no-cache
X-Requested-With: XMLHttpRequest
Content-Type: multipart/form-data; boundary=---------------------------2145367098165317569351000797
Content-Length: 240
Origin: http://192.168.1.1:8000
Connection: close
Referer: http://192.168.1.1:8000/

-----------------------------2145367098165317569351000797
Content-Disposition: form-data; name="files[0]"; filename="test.txt"
Content-Type: text/plain

This is a test file

-----------------------------2145367098165317569351000797--