|
Posted by Erwin Moller on 08/30/07 09:11
Defacta wrote:
> Hi,
>
> When I upload an excel file, PHP does not recognize the type of this
> file:
>
> echo $HTTP_POST_FILES['file']['type'] ;
>
> returns: application/octet-stream
> Whereas a word file returns: application/msword
>
> Do you know if there is anyway to get the type of a excel file ?
>
> Thanks,
> Vincent.
>
Hi Vincent,
From http://nl3.php.net/manual/en/features.file-upload.php
------------------------------------------------------------------------
$_FILES['userfile']['type']
The mime type of the file, if the browser provided this
information. An example would be "image/gif". This mime type is however
not checked on the PHP side and therefore don't take its value for granted.
------------------------------------------------------------------------
Bottomline: don't rely on this.
And the value application/octet-stream just means it is a binary file,
which is correct in this case, but little informative.
Regards,
Erwin Moller
[Back to original message]
|