本文介绍了多文件上载仅在第二次单击时有效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用jquery.MultiFile.js在更新面板中使用fileupload控件上传多个文件,并使用触发器在按钮点击时回发但是在第一次单击时它只上传一个文件并开始上传多个文件,之后是我的代码
I am using jquery.MultiFile.js to upload multiple files using fileupload control in an update panel and using trigger to postback on button click but on first click it uploads only one file and starts uploading multiple files after that below is my code
HttpFileCollection fileCollection = Request.Files;
for (int i = 0; i < fileCollection.Count; i++)
{
HttpPostedFile uploadfile = fileCollection[i];
string file = Path.GetFileName(uploadfile.FileName);
string extension = Path.GetExtension(file);
if (uploadfile.ContentLength > 0)
{
string no = Guid.NewGuid().ToString().Substring(0, 4);
string path = @"../Gallery/";
string serverpath = Server.MapPath(path);
string fullpath = serverpath + no + file;
uploadfile.SaveAs(fullpath);
valid += file + " saved successfully\\n";
}
谢谢
Thanks
推荐答案
这篇关于多文件上载仅在第二次单击时有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!