關閉
標題:C# file upload 上傳 檔案大小
內容:
HttpPostedFile file = Request.Files["uploads"];
file.SaveAs(path+"/uploads/"+filename);
string data = my.b2s(file_get_contents(path +"/uploads/"+ filename));
ASP.net Web.config裡寫下以下區段
<system.web>
<httpRuntime maxRequestLength="102400" executionTimeout="600"/>
</system.web>
maxRequestLength 檔案大小(KB),預設值4096 KB(4MB),所以102400KB為100MB
executionTimeout 上傳時間(秒),600秒為10分鐘
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="104857600" />
</requestFiltering>
</security>
</system.webServer>
maxAllowedContentLength 檔案大小(byte),所以104857600(1024*1024*100)為100MB