我有一个aspx上传控件和一个带有文件夹作为项目的asp下拉列表
我正在尝试将文件上传到目录/所选文件夹(从下拉列表中)
protected void ASPxUploadControl1_FileUploadComplete(object sender, DevExpress.Web.ASPxUploadControl.FileUploadCompleteEventArgs e)
{
if (e.IsValid)
{
string uploadDirectory = Server.MapPath("~/files/");
//string uploadDirectory = "//DOCSD9F1/TECHDOCS/";
string fileName = e.UploadedFile.FileName;
string uploadFolder = DropDownList1.SelectedValue;
e.UploadedFile.SaveAs(uploadDirectory + uploadFolder + "/" + fileName);
e.CallbackData = fileName;
}
}
答案 0 :(得分:1)
您可以在保存文件之前尝试使用MapPath吗?
e.UploadedFile.SaveAs(Server.MapPath(uploadDirectory + uploadFolder + "/" + fileName));