多个上传图片 [英] Multiple upload Image
本文介绍了多个上传图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有谁能告诉我,用asp.net中的一个浏览按钮上传多个图像,代码为...我看过很多博客,但我没有找到使用一个浏览按钮..
解决方案
试试这个Ajax DLL控件
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AjaxFileUpload/AjaxFileUpload.aspx
在你的aspx文件中使用它:
< asp:fileupload id =file1Uploaderrunat =serverallowmultiple =true/>
< asp:button id =testUploadrunat =servertext =Clickonclick =testUpload_Clickxmlns:asp =#unknown/>
然后在你的.cs文件中写这个,用于testUpload Click事件:
string path = Server。 MapPath(〜/ UploadFile /);
foreach(file1Uploader.PostedFiles中的HttpPostedFile文件)
{
string path1 = path + file.FileName;
file.SaveAs(path1);
}
参考此链接: -
http://csharpdotnetfreak.blogspot.com/2012/07 /asynchronous-file-upload-jquery-uploadify-aspnet.html [ ^ ]
http://www.aspsnippets.com/Articles/Multiple-File-Uploads-Gmail-Style-using- JQuery-and-ASP.Net.aspx [ ^ ]
Hi,
Can anyone tell me,Uploading multiple images with one browse button in asp.net with code....I seen so many blogs,but i didn''t find using with one browse button..
解决方案
Hi,
Try this Ajax DLL Control
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AjaxFileUpload/AjaxFileUpload.aspx
Use this in your aspx file:
<asp:fileupload id="file1Uploader" runat="server" allowmultiple="true" />
<asp:button id="testUpload" runat="server" text="Click" onclick="testUpload_Click" xmlns:asp="#unknown" />
Then write this in your .cs file, for testUpload Click event:
string path=Server.MapPath( "~/UploadFile/");
foreach (HttpPostedFile file in file1Uploader.PostedFiles)
{
string path1=path+file.FileName;
file.SaveAs(path1);
}
Refer this links:-
http://csharpdotnetfreak.blogspot.com/2012/07/asynchronous-file-upload-jquery-uploadify-aspnet.html[^]
http://www.aspsnippets.com/Articles/Multiple-File-Uploads-Gmail-Style-using-JQuery-and-ASP.Net.aspx[^]
这篇关于多个上传图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文