Reputation: 73
I have a php web app that I deploy to multiple servers. It works on my local installation as well as every other server I put it on.
But on the current server I'm deploying to, I'm having trouble with all of the file upload features.
When trying to debug it, I realized they are failing when trying to get the finfo(FILEINFO_MIME_TYPE).
Example: a form has an upload field called "file_import". I put in the following line of code into the shared import function.
die(print_r($_FILES['file_import']));
On my local installation, it returns:
Array
(
[name] => US Capital Division.csv
[type] => application/vnd.ms-excel
[tmp_name] => C:\wamp\tmp\php3B7C.tmp
[error] => 0
[size] => 1268
)
1
Uploading the same file on the current deployment it returns:
Array
(
[name] => US Capital Division.csv
[type] => application/vnd.ms-excel
[tmp_name] => /tmp/phpJdRZDW
[error] => 0
[size] => 1268
)
1
They both say they have no errors, but the deployment server only gives the folder name for the tmp_name value, while the local installation gives the temp folder AND file name. So when my code try $_FILES['file_import']['tmp_name'] it errors.
I feel like it has to be server setting or folder setting, but I can't find anything on the web as to what would cause that.
Thanks.
Upvotes: 1
Views: 1859
Reputation: 3665
Actually, the phpJdRZDW
inside [tmp_name] => /tmp/phpJdRZDW
is not a folder... It's just a temporary file name while the file sits inside the /tmp/
folder (waiting to be moved and [usually] renamed).
Upvotes: 0