Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 7th, 2007, 12:55 AM
Registered User
 
Join Date: Apr 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Strange Upload Issue

I have a webform which I and several other people are able to use to upload JPEG images to my website. I test to see if the upload file is a JPEG with this conditional line:
Code:
if ( ( aHTMLFile.PostedFile.ContentType != "image/pjpeg" ) & ( aHTMLFile.PostedFile.ContentType != "image/jpeg" ) ) {
Where "aHTMLFile" is a parameter of type HtmlInputFile passed into the method that validates the type.

However, I have one user who is submitting a JPEG file where this fails. The message I post back indicates that the aHTMLFile.PostedFile.ContentType is "JPEG File", and not either of the two mime types I'm looking for.

I've never seen this type of mime type before. The problem occurs on both his desktop (running IE7) and laptop (running IE6).

Personally I run Firefox with an embedded IE engine (which should be the same renderer as IE7). I've tested it with native FireFox, Safari, and IE. I've also tested it with the out-of-the-box IE7 and had no issues with exactly the same file he is using to upload.

He is using anti-spyware, anti-spam, anti-virus software. Is it possible that one of these programs might be causing the browser to change the mime type?

I don't know how to advise him because I don't know what the problem is.

Any ideas?

Thanks,
- El

 
Old April 8th, 2007, 10:21 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

That is a strange problem. I don't know why you are seeing this behavior.

Can you work around the problem by looking at the file's extension instead of the mime type?

-Peter
 
Old April 8th, 2007, 11:26 PM
Registered User
 
Join Date: Apr 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Technically yes, however, that would violate the security policy.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Very Strange issue with a php form Tracysgoingnutsagain Beginning PHP 0 April 11th, 2008 04:44 PM
strange file upload problem dan195 ASP.NET 1.0 and 1.1 Basics 0 January 28th, 2007 12:36 AM
Excel Upload Issue anandham Classic ASP Components 3 June 20th, 2006 11:46 PM
Strange ArrayIndexOutOfBoundsException ISsue kapweb J2EE 0 January 7th, 2006 07:35 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.