开发者

save image from fileupload

I am using fileupload control to have image on the form and that that image has to be saved on some folder in hard disk say "E:\\asp_net".

Is there any possible way to save image on disk from fileupload and if there is any other image with same name, 开发者_如何学Pythonit should be overwritten?


Why do you need to save the file in your machine's E drive?

Your ultimate option should be in your Application Folder. It should be like...

 FileUpload1.SaveAs(Server.MapPath("~/AppFolderName/" + FileName));


You're looking for the cunningly-named SaveAs method.


following videos cover for your needs;

http://www.asp.net/general/videos/how-do-i-simple-file-uploads-in-aspnet

http://www.asp.net/general/videos/how-do-i-multiple-file-uploads-in-aspnet-1

http://www.asp.net/general/videos/how-do-i-multiple-file-uploads-in-aspnet-2


var filename = Path.Combine(@"E:\asp_net", myFileUploadControl.FileName);
if (File.Exists(filename))
   File.Delete(filename);
myFileUploadControl.SaveAs(filename);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜