Skip to content
Advertisement

PHP file upload works with HTTP form but not with Python script

I’m currently achieving a python project in which I need to have a text file uploaded through HTTP to my server.

At first I was using for convenience an HTTP form and the upload has been working fine. But now, I want it so I don’t have to manually select the file and just have my Python script sending the file for me.

But even if the Apache2 logs indicate that a POST Request have been received by the server while using the Python script, the file is not uploaded.

PHP

JavaScript

WORKING HTML FORM

JavaScript

PYTHON

This script has been tested with httpbin.org/post and I have received only code 200.

JavaScript

APACHE2 LOGS

Here are the server logs. The first line is a successful upload by the HTML form, the second is an unsuccessful attempt from the python script.

JavaScript

Can someone indicates me if I need to change something about the script or the php side to have my file uploaded ?

Advertisement

Answer

You named your file 987654321.txt, not filer as expected:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement