a fiewA few points :
- make sure to submit your request to the corectcorrect url ( the form 'action' )
- use the
dataparameter to submit other form fields ( 'dir', 'submit' ) - include the name of the file in
files( this is optional )
code :
import requests
url = 'http://example.com' + '/upload.php'
data = {'dir':'/uploads/', 'submit':'Submit'}
files = {'file':('1.jpg', open('1.jpg', 'rb'))}
r = requests.post(url, data=data, files=files)
print(r.content)