Skip to content Skip to sidebar Skip to footer

Large File Upload Fails

I'm in the process of writing a python module to POST files to a server , I can upload files of size of upto 500MB but when I tried to upload a 1gb file the upload failed, If I wer

Solution 1:

The script in question isn't very smart and builds the POST body in memory.

Thus, to POST a 1GB file, you'll need 1GB of memory just to hold that data, plus the HTTP headers, boundaries, and python and the code itself.

You'd have to rework the script to use mmap instead, where you first construct the whole body in a temp file before handing that file wrapped in a mmap.mmap value to passing it to request.add_data.

See Python: HTTP Post a large file with streaming for hints on how to achieve that.

Post a Comment for "Large File Upload Fails"