468,531 Members | 1,605 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,531 developers. It's quick & easy.

File excel not recognized

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.

Aug 30 '07 #1
1 1941
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
Aug 30 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Arnab Nandi | last post: by
5 posts views Thread by Daniel Corbett | last post: by
4 posts views Thread by Looch | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.