0

I have a VB.NET software that uploads files using an HTTP request to PHP. This worked fine until May but now it fails when uploading files over 65KB. I can not tell when it stops to work exactly. Even though, I don't think it is relevant. So to be clear, uploading a file under 65KB works correctly.

I looked with my hoster and he doesn't see any error neither do I on the server (the part I have access). VB.NET doesn't give me a pertinent error, but using WireShark, I've been able to get either a 500 or a 400 error. But it didn't give me clues on what is failing.

I verified this question which is not solved, though the things said there are OK on the server too. PHP not uploading file over 55 kb

I have another option to fix it: splitting my files in chunks of 50KB and rejoining them via PHP. Though, I rather understand what is happening because this can happen again even with chunks of 50KB.

Server is Apache/2.4.28 (Unix)

EDIT 1 I have new conditions: I now have my own server running on Windows + Apache 2.4 + PHP 5.6.

Now it goes a little farther. I have an error when using move_uploaded_file function that gives me: Error #3: The uploaded file was only partially uploaded. It is coherent with the file being stopped to be sent near the end. So I now receive an HTTP 200 response but a failure after ward even though I suspect not being there.

  • I can certify I did not stop my VB.NET software that is uploading the file.
  • I tested changing KeepAlive to Off/False on both sides. No luck :(
  • Tried to add header ("Connection: close"); in my main file (that is used for all transactions with this VB.NET software). No luck.
  • Even though, it is not currently an issue, I changed (PHP configs) the upload_max_filesize to 256M and post_max_size to 300M (because it will be a problem if a can figure out this one).

I got those suggestions from : https://wordpress.stackexchange.com/questions/176465/failed-media-upload-the-uploaded-file-was-only-partially-uploaded

The only one I could not try is replacing an apache/php module which doesn't seem to exist on Windows.

Master DJon
  • 1,899
  • 2
  • 19
  • 30

1 Answers1

0

Depending on your server's configuration, when an error 500 is returned an error_log is written. The problem is with the error 400. Which according to wikipedia's list of HTTP codes is actually a BAD REQUEST. Some output from your error_log when the attempt is being made might put us in the right direction.

Ma͢dalin
  • 1
  • 5
  • I would like, but neither the person who is hosting or me are seeing any error log. – Master DJon Oct 27 '17 at 19:26
  • If you're posting to a PHP file, you can make sure that you add `error_reporting(E_ALL);` at the TOP of your php file (right after ); This will generate a file called `error_log` in your file's path. – Ma͢dalin Oct 27 '17 at 19:42
  • OK! This was an old PHP code, so I refreshed it to my latest framework version and I added `error_reporting(E_ALL)`. Unfortunately, no error in error_log. But that is maybe normal because it is an error 400. Do you have any clues to give to my host so we could figure out what is happening? – Master DJon Nov 06 '17 at 20:38
  • Maybe you could check your apache's error_log ? Could be a faulty module or something too. It's really hard to pinpoint the issue. If it's NOT a PHP error then it's more likely an apache/apache module error. – Ma͢dalin Nov 09 '17 at 13:39
  • Can you look at my **EDIT 1** please? Thank you! – Master DJon Jan 12 '18 at 03:32
  • I fixed it! It was on VB.NET side and I really don't understand what is happening. I was setting the ContentLength header and without it, BANG, it works. Thank you anyway. Shall I accept your answer anyway or create mine? – Master DJon Jan 12 '18 at 04:05