Strange behaviour on upload
| From: | Ingwie Phoenix) | Date: | Sun, 29 Mar 2015 21:16:23 +0000 |
| Subject: | Strange behaviour on upload | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-85532@lists.php.net to get a copy of this message | ||
Hey.
I am running my PHP app through a NodeJS server using a FastCGI bridge. Today, I was about to
implement an image uploader on my site - only to realize that file uploads were not possible.
So I generated a few files and tested how big the files must be for the upload to fail. I got
surprised how early this happened:
Ingwie@Ingwies-Macbook-Pro.local ~/W/BIRD3 $ genfile 31k text.txt; and curl -v -4 -X POST -F
"img=@text.txt" http://localhost:8080/user/changeAvatar
(…)
Ingwie@Ingwies-Macbook-Pro.local ~/W/BIRD3 $ ls -l text.txt
-rw-r--r--+ 1 Ingwie staff 63488 29 Mär 23:10 text.txt
the genfile command is a simple function:
function genfile
command dd if=/dev/urandom of=$argv[2] bs=$argv[1] count=2
end
(I am using the fish shell, so its slightly different to Bash.)
The error that I am seeing on the PHP end is that the file array’s error property shows „3“,
which is the UPLOAD_ERR_PARTIAL constant.
My question is, under which conditions is that error triggered? I can verify that my NodeJS FCGI
bridge is correctly giving all bites to the process, so PHP should actually have the entire request
body (the file names and contents) at hand.
BTW, my backend is talking to PHP via php-fpm.
Kind regards, Ingwie.