MIME types reported by browser during file upload

  • Thread starter Thread starter gnemesis
  • Start date Start date
G

gnemesis

I am trying to resolve an issue with a file upload control (written by
someone else). This control attempts to validate the file being
uploaded by checking its MIME type. For ths application, the files
being uploaded must be Flash (.flv) files.

The control uses a simple file input control, and checks
PostedFile.ContentType, which for .flv files should be "video/x-flv".
This check seems to work flawlessly MOST of the time, but on a couple
of test machines, the browser reports the MIME type as
"application/octet-stream". This behaviour occurs regardless of the
browser used (I have tested Firefox, 3 versions of IE, Safari and
Chrome).

What I have been unable to determine is what might cause the browser
to mis-report the MIME type. I have eliminated the file itslf as the
issue, since I have performed my testing with the same file on all
test platforms.

Any assistance with this one would be most appreciated.

=jeff
 
[...]
The control uses a simple file input control, and checks
PostedFile.ContentType, which for .flv files should be "video/x-flv".
This check seems to work flawlessly MOST of the time, but on a couple
of test machines, the browser reports the MIME type as
"application/octet-stream". This behaviour occurs regardless of the
browser used (I have tested Firefox, 3 versions of IE, Safari and
Chrome).

What I have been unable to determine is what might cause the browser
to mis-report the MIME type. I have eliminated the file itslf as the
issue, since I have performed my testing with the same file on all
test platforms.

Just to be clear: you are testing using the same file _everywhere_. That
file, downloaded on some machines, correctly reports the MIME content
type, while downloaded on some other machines, does not?

If that's the correct understanding of your post, then you probably should
be looking at the file associations in Explorer. The machines where the
file type doesn't work probably either don't have the Flash player
installed, or the file association got broken somehow.

In any case, it's not really a C# question...you'll get a much better
answer in a more appropriate forum, I think.

Pete

To answer the question, yes, the same file is being used everywhere.
But this issue is not about downloading this file, rather uploading it
to a web server. The upload control checks the mime type of the
uploaded file to verify that it is in fact a .flv file, rather than
checking the extension (which I may have to resort to).

I've checked the file associations, and it does not seem to affect
this; many of the test machines have no file association for .flv and
this process works on those machines as well as some that have file
associations. Further note which I uncovered today: there IS a point
of commonality among the failing machines: they are all Windows Server
2003. I think I'll find an OS-specific newsgroup and repost this
question there.

I apologise for misplacing his post; the application is written in C#,
and I guess I mentally defaulted to this group.

Thanks for taking the time to reply.

=jeff
 
Back
Top