Good evening everyone,

I try to post a file (100MB) on a Web form with python3 and the 'requests' 
package. 

This is my implementation : 

--------------------------------------BOF-------------------------------------------------

#!/usr/local/bin/python3 -u
 
import requests
 
email="u...@srv.fr"
 
try:
    res = requests.post('http://server/Upload/upload.php',
                        files={'aFile': open('/tmp/test.zip','rb')},
                        data={'email': email, 'submitFile': 'Envoyer le 
fichier'})
 
except requests.exceptions.Timeout:
    print('timeout')
 
print(res.content)

--------------------------------------EOF-------------------------------------------------

This code semas to be correct, but it return a ConnectionResetError: 
[Errno 104] Connection reset by peer 

The same upload with curl work perfectly with this command : 

curl --form aFile=@"/tmp/test.zip" --form email="u...@srv.fr" --form 
submitFile="Envoyer le fichier" http://server/Upload/upload.php

Thanks to the advance 

Florian
_______________________________________________
python-uk mailing list
python-uk@python.org
https://mail.python.org/mailman/listinfo/python-uk

Reply via email to