PDA

View Full Version : سوال: معادل کد #C کپی فایل در فولدر برنامه در ASP.net



shahrzad87
یک شنبه 24 مهر 1390, 14:32 عصر
سلام دوستان
معادل کد زیر تو asp.net چی میشه ؟


string output;
output = Path.GetDirectoryName(Application.ExecutablePath);
output = Path.Combine(output, "sounds");
output =Path.Combine(output,Path.GetFileName(txt_Name_Wav eSett.Text+".wav"));
File.Copy(txt_Path_WaveSett.Text, output, true);



کد زیر رو نوشتم ولی اشتباهه:


bannerfile = System.IO.Path.GetFullPath(file_banner_admin.Poste dFile.FileName);

rootPath = Path.Combine(rootPath, "image");

rootPath = Path.Combine(rootPath, Path.GetFileName(file_banner_admin.PostedFile.File Name));
File.Copy(bannerfile, rootPath, true);

shahrzad87
یک شنبه 24 مهر 1390, 15:10 عصر
جوابش رو پیدا کردم،


rootPath = (server.MapPath("~"))
if(fileUpload1.hasFile)
string FileName = FileUpload1.FileName;
rootPath = rootPath+"\\"+fileName;
FileUpload1.SaveAs(rootPath);