开发者

aspx file upload control with drop down list path

I have an aspx upload control and a asp drop down list with folders as开发者_如何学JAVA the items

I am trying to get the file to upload to the directory/ the selected folder ( from the drop down )

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;
        }
    }


Can you try using MapPath just before saving file?

e.UploadedFile.SaveAs(Server.MapPath(uploadDirectory + uploadFolder + "/" + fileName));
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜