473,390 Members | 1,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,390 software developers and data experts.

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 2079
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Arnab Nandi | last post by:
We are using the Sun Workshop 6 C++ compiler to compile some CPP files. The command line looks like follows: - CC -g -xsb -c -o output/x.o x.cpp We get the following error: - CC: language...
0
by: Peter | last post by:
I am having a problem reading an Excel file that is XML based. The directory I am reading contains Excel files that can be of two types. Either generic Microsoft based or XML based. I am reading...
5
by: Daniel Corbett | last post by:
I am trying to save a file dynamically created in a webpage. I get the following headers, but cannot figure out how to save the attachment. I am basically trying to replicate what internet...
6
by: Piotr | last post by:
Hi, I have following problem: I use a form in excel to send data into mysql server, everything is ok unless I have to deal with decimals or data fields, this simple are not recognized. For...
3
by: Phoe6 | last post by:
Hi all, I had a filesystem crash and when I retrieved the data back the files had random names without extension. I decided to write a script to determine the file extension and create a newfile...
4
by: Looch | last post by:
Thanks in advance for any help. I'm having trouble with this code: Dim xlsApp As Excel.Application Dim xlsWB As Excel.Workbook xlsApp = New Excel.Application xlsApp.Visible = True ...... ...
0
by: Patrice | last post by:
Hello, I'm streaming an Excel file to IE using the content-disposition header. If the user opens the file, Excel appends a "" to its name (the name looks file in IE temporary internet files). It...
2
by: JimmyKoolPantz | last post by:
We purchased som software for encoding a barcode. We want to automate the process of converting a number to a readable barcode. However, I am having a few issues. The file that the barcode...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.