Click here to Skip to main content
13,144,679 members (36,083 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
i want to store image in image folder not in database,how can i do this.please give complete code that can i understand
Posted 11-Jun-12 3:28am
Updated 13-Feb-17 2:08am
Comments
RDBurmon 13-Jun-12 9:30am
   
Thanks Everyone who replied to this thread , So Manohar, I think you have got enough responses and you should be able to mark it as your answer and close the thread. Please do so.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

<asp:FileUpload ID="fupload" runat="server" Height="21px" Width="220px" />

Add One Asp Button try this below code in that button click
string strFileName = DateTime.Now.ToString("MM-dd-yyyy_HHmmss");
string strFileType = System.IO.Path.GetExtension(fupload.FileName).ToString().ToLower();
fupload.SaveAs(Server.MapPath("folderpath" + strFileName + strFileType));
  Permalink  
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Try:
myImage.Save(path, ImageFormat.Jpeg);
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 5

.........It may work
if (imgUpload.HasFile)
        {
            //Check File is available in Fileupload control and then upload to server path
            fname = imgUpload.FileName;
            //spath = @"~\ImgUpload\" + FileUpload.FileName;
            fpath = Server.MapPath("ImgUpload");
            fpath = fpath + @"\" + imgUpload.FileName;
            string getext = Path.GetExtension(imgUpload.PostedFile.FileName);
            string filename = Path.GetFileNameWithoutExtension(imgUpload.PostedFile.FileName);
            string strFilePath = filename + DateTime.Now.ToString("yyyyMMdd") + getext;
            if (getext != ".JPEG" && getext != ".jpeg" && getext != ".JPG" && getext != ".jpg" && getext != ".png" && getext != ".tif" && getext != ".tiff")
            {
                Page.ClientScript.RegisterStartupScript(typeof(Page), "successfull", "alert('Please upload only jpeg, jpg,png,tif,tiff'); window.location = 'ParivarRegistration.aspx';", true);
            }
            else
            {
                imgUpload.SaveAs(Server.MapPath(@"~\ImgUpload\" + strFilePath));
                ImageShow.ImageUrl = @"~\ImgUpload\" + strFilePath;
                ViewState["fname"] = fname;
                ViewState["fPath"] = @"~\ImgUpload\" + strFilePath;
            }
        }
        else
        {
             lblMessage.Text = "Please select file!";
             
        }
  Permalink  
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 6

string path = @"~/imgage/";
string picture = "your picture name with extention";
                                path = Path.Combine(Server.MapPath(path), picture);
                                using (WebClient wc = new WebClient())
                                {
wc.DownloadFile("http://www.example.com/image/abc.jpg", path);
                                }
  Permalink  
Comments
NotPolitcallyCorrect 13-Feb-17 12:54pm
   
Why are you answering already answered FIVE year old questions?

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web03 | 2.8.170915.1 | Last Updated 13 Feb 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100