Click here to Skip to main content
15,908,776 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI created

FileUpload newf = new FileUpload();


DayImgName="hewded.jpg";

string fileName_t = Path.Combine(@"D:\images\packages\", DayImgName);

newf.SaveAs(fileName_t);


but the image is not copied to that folder
Posted
Comments
Karthik_Mahalingam 23-Jan-14 8:54am    
what exception you are facing ?
maulikshah1990 24-Jan-14 0:17am    
when i goto save image file in folder as above, it is not saving there...

Just check if WRITE permission is given to that folder or not?

If your application is web application and you have hosted it in IIS, then check if Worker process has write permission or not.
 
Share this answer
 
Comments
maulikshah1990 23-Jan-14 6:45am    
In above code, i created FileUpload in cs code ,

but when i create asp.net FileUpload control , and directly , when i use that, it saves directly...
 
Share this answer
 
Try this code:

ASP.NET
<asp:fileupload id="issueCommentFileUpload" runat="server" xmlns:asp="#unknown" />



C#
string issuefileName = string.Empty;
            if (issueCommentFileUpload.HasFile)
                try
                {
                    issuefileName = issueCommentFileUpload.FileName;
                    string destinationPath = Server.MapPath("./Upload/" + issuefileName);
                    issueCommentFileUpload.SaveAs(destinationPath);
                }
                catch (Exception exObj)
                {
                    Response.Write("Some thing wrong");
                    log.Error("GetIncedencePrimaryInfo method Sql Error : " + exObj.Message.ToString());
                }
 
Share this answer
 

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