protected string UpLoadFile(FineUIPro.FileUpload fp_name, string folderName)
{
string fileFullPath = string.Empty;
if (fp_name.HasFile)
{
//上传文件到服务器
//string filePath = "~/Upload/" + folderName + "/";
string filePath = "~/upload/" + folderName;
if (!Directory.Exists(Server.MapPath(filePath)))
{
Directory.CreateDirectory(Server.MapPath(filePath));
}
string fileName = fp_name.ShortFileName;
int fileSize = fp_name.PostedFile.ContentLength;
string[] allowExtension = { ".doc", ".docx", ".xls", ".xlsx" };
if (!allowExtension.Contains(GetFileType(fileName)))
{
Alert.ShowInTop("此文件类型不符合要求,不允许上传!");
return null;
}
//fileFullPath = filePath + "/" + Guid.NewGuid().ToString() + ".jpg";
fileFullPath = filePath + fileName;
hid_filename.Text = fileName;
hid_filepath.Text = fileFullPath;
fp_name.SaveAs(Server.MapPath(fileFullPath));
}
return fileFullPath;
}
}
protected void FileUpload5_FileSelected(object sender, EventArgs e)
{
UpLoadFile(FileUpload5, "SHENGCHANYXZB");
}
基于空项目重现问题,发到我的QQ邮箱
我把前台和后台代码发给你可以吗?我没有空的项目
另外,我把FINEUI 官网的事例建了个新的页面,结果还是false
如果是ajax的话可能产生这个问题,另外如果你够笨的话也会产生这个问题!
上传文件,要设置Form的enctype=multipart/form-data。
问题自己解决了