2008-12-12 64 views

回答

7

(我已經回答了這個問題我自己,我只是發現通過古爾或SO答案的問題,它似乎有用...)

此代碼爲我所需要的,這要歸功於Suprotim阿加瓦爾http://www.dotnetcurry.com/ShowArticle.aspx?ID=68

一旦文件已被使用合適的jQuery多個上傳控制(從fyneworks http://www.fyneworks.com/jquery/multiple-file-upload/#tab-Overview例如多文件) 選擇,並且在提交按鈕被點擊,調用以下代碼aspx文件

HttpFileCollection hfc = Request.Files; 
for (int i = 0; i < hfc.Count; i++) 
{ 
    HttpPostedFile hpf = hfc[i]; 
    if (hpf.ContentLength > 0) 
    {    
     hpf.SaveAs(Server.MapPath("Uploads") + "\\" + System.IO.Path.GetFileName(hpf.FileName)); 
    } 
} 
+0

感謝,這正是我要尋找 – sean717 2010-05-07 23:56:29

1

HttpFileCollection uploads = HttpContext.Current.Request.Files;

的for(int i = 0;我< uploads.Count;我++){

 HttpPostedFile upload = (HttpPostedFile)uploads[i]; 
相關問題