سلام، اگه کسی دنبال این هست،
این جوابه>>>>
public class utility {
public static string getfilename(string fileAddress)
{
// اسم فایل رو از آدرس میگیریم
return System.IO.Path.GetFileName(fileAddress);
}
public static string getfilepath(string fileAddress, string path)
{
// اسم فایل رو از آدرس میگیریم
var filePath = getfilename(fileAddress);
return System.IO.Path.Combine(Server.MapPath("~"), path, filePath);
}
}
اینم طرز استفاده:
var fileName = utilty.getfilename(uploadimage.FileName);var path = utilty.getfilepath(uploadimage.FileName, "files\\pictures");
texttbl.photopath = imagepath = path;
uploadimage.SaveAs(imagepath);
موفق باشید.