Solved

Picture Upload in asp.net

Posted on 2011-09-08
3
259 Views
Last Modified: 2012-05-12
I want to upload pictures only using the file upload control .
what wud be the C# code for that

thanks
0
Comment
Question by:ASPNET_8
3 Comments
 
LVL 8

Accepted Solution

by:
vsudip earned 500 total points
ID: 36501641
0
 
LVL 29

Expert Comment

by:Kumaraswamy R
ID: 36501693
try

System.Drawing.Image img = System.Drawing.Image.FromStream(FileUpload1.PostedFile.InputStream);

if (img.RawFormat.Guid == System.Drawing.Imaging.ImageFormat.Jpeg.Guid)
 {
  //Ur coding

}

// if you want to return the type of the image, try this:

    public static string MimeType(System.Drawing.Image imgPhoto)
    {
        foreach (ImageCodecInfo codec in ImageCodecInfo.GetImageDecoders())
        {
            if (codec.FormatID == imgPhoto.RawFormat.Guid)
                return codec.MimeType;
        }
        return "image/unknown";
    }
0
 

Author Closing Comment

by:ASPNET_8
ID: 36586076
Was not that helpful
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now