I can use form to upload pictures on my site,but when I upload mp3 files, it doesn't work
I use form in asp.net mvc site to upload files, the code goes like this:
@using (Html.BeginForm("AddFiles", "Manageme开发者_如何学编程nt", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.ValidationSummary(true)
<fieldset>
<div class="editor-field">
<input type="file" id="fileToBeUploaded" name="fileToBeUploaded"/>
</div>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
}
I can use this to upload pictures and text, but when I try to upload mp3 and wmv files, it can't direct to AddFiles action.
Any ideas?
Are these files' sizes are more than 4MB? It's the default file size in the configuration file. If that's the case you have to change it to upload larger files.
Update:
There is Web.config file in your project.Find this line there:
<system.web>
Add your custom maxRequestLength by adding this line under it:
<httpRuntime maxRequestLength="102400"/>
This means a request can be long as 102400 KB or 100 MB. You can type it and see Intellisense help you.
精彩评论