Click here to Skip to main content
15,042,814 members
Please Sign up or sign in to vote.
1.80/5 (3 votes)
See more:
sample code to upload photo using C#
Posted
Comments
joginder-banger 14-Dec-13 1:58am
   
In which language try you???
Member 10452585 14-Dec-13 2:23am
   
aspx

Comments
jackspero18 14-Dec-13 2:04am
   
but it will convert your image in bytes and then stores.... lengthy proccess
   
It is not lengthy. Either you can store in folders or database. If you use file system, more space is required.
   
In asp .net you can try this type
C#
protected void Submit(object sender, EventArgs e)
    {
        if (Path.GetExtension(FileUpload1.FileName) == ".jpg")
        {
            FileUpload1.SaveAs("path of where you save picture");

        }
        else
        {
            Response.Write("<script>alert('Invalid format')</script>");
        }

    }


For any query hit reply..
   
Comments
joginder-banger 14-Dec-13 2:11am
   
why down vote this answer????
Member 10452585 14-Dec-13 2:21am
   
path of where you save picture mean the folder you save the photo ?
joginder-banger 14-Dec-13 3:20am
   
yes...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900