Hi,
This does not work either. Firefox always sends Mime type based on file
extension. IE does send Mime type regardless of file extension, but this
solution only works if all your clients use IE.
Isn't there a way to verify image on the server side?
"Walter Wang [MSFT]" wrote:
> Hi,
> You should check the uploaded file's ContentType to determine the real fil
e
> type, the ContentType will return "image/x-png" for a PNG file and
> "image/gif" for a GIF file regardless the file extension:
> protected void Button1_Click(object sender, EventArgs e)
> {
> if (FileUpload1.HasFile)
> {
> string ct = FileUpload1.PostedFile.ContentType;
> Response.Write(ct);
> }
> }
>
> Hope this helps.
>
> Sincerely,
> Walter Wang (wawang@dotnet.itags.org.online.microsoft.com, remove 'online.')
> Microsoft Online Community Support
> ========================================
==========
> Get notification to my posts through email? Please refer to
> [url]http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif[/ur
l]
> ications. If you are using Outlook Express, please make sure you clear the
> check box "Tools/Options/Read: Get 300 headers at a time" to see your repl
y
> promptly.
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscript...t/default.aspx.
> ========================================
==========
> This posting is provided "AS IS" with no warranties, and confers no rights
.
>Hi,
Thank you for your quick update. I understand that the MIME ContentType
approach is not what you wanted. I will do some further research to see if
there's any other methods.
By the way, I'm not able to find the issue you mentioned that IE will load
a .PNG file faked in .GIF file type and the script will be executed by
JScript engine. Would you please let me know where you see the information
on this? Thanks.
Regards,
Walter Wang (wawang@.online.microsoft.com, remove 'online.')
Microsoft Online Community Support
========================================
==========
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
==========
This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment