I am uploading a pdf and I am getting this on the $_FILES array
Array
(
[userfile] => Array
(
[name] => diyautoparts.pdf
[type] => application/force-download
[tmp_name] => C:\Windows\Temp\phpFD61.tmp
[error] => 0
[size] => 40449
)
)
I was expecting application/pdf. Can someone explain? Thank you
unexpected file type during upload
Moderator: General Moderators
Re: unexpected file type during upload
I would assume that the variable comes from the browser and therefore cannot be relied on.
Re: unexpected file type during upload
Yes. Yes yes yes. Very yes.Benjamin wrote:I would assume that the variable comes from the browser and therefore cannot be relied on.
Re: unexpected file type during upload
What are the alternatives? I now there is fileinfo in 5.3 But I dont have 5.3 available
Re: unexpected file type during upload
5.3 merely has fileinfo built-in. You can still get it separately for PHP <5.3.
Re: unexpected file type during upload
Never rely on the mime types given for uploaded files since with header injection its possible to change them to whatever a hacker wants to