Hi to you all.
I am working on an application that accepts various source files from the users and stores them on the server with the appropriate extension e.g (.cpp, .py).
This has been working fine as php allows a programmer to check the type of the uploaded file type using

$_FILES['my_file']['type']

variable. For c++ files they are identified as 'text/c++src', C source files are identified as 'text/csrc' and so on. Therefore getting the file extension to use when storing the file is quite easy.
Firefox works fine but when using a different browser (opera 9.0 to be specific) php identifies all the source files as 'application/octet-stream' therefore my program treats the file as an unknown one and gives it a general extension.
So my question is, "Does the browser have an effect on the type of a file uploaded?"
Happy times

Recommended Answers

All 2 Replies

So my question is, "Does the browser have an effect on the type of a file uploaded?"

Yes because if you go into the Opera preferences you will see that Opera will only recognize web related mime types. Other mime types are not programmed into Opera where as a browser like firefox may use the windows file system to recognize file types.

Many thanks cwarn23. Your explanation was short and exhaustive.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.