怎么上传MP3文件上传

怎样上传MP3文件上传


@(TempData["message"] == null ? "" : TempData["message"].ToString())
@using (Html.BeginForm("UploadMusic", "Special", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
  @Html.ValidationSummary(true)
  <fieldset>
  <legend>上传音乐请选择MP3格式的音乐上传</legend>
  <div class="editor-field">
  <input type="file" name="MusicUrl" accept="mp3"/>
  </div>
  <p>
  <input type="submit" value="上传" />
  </p>
  </fieldset>
}






public ActionResult UploadMusic(int id, FormCollection collection)
  {
  Special special = (from s in weblog.Special
  where s.SpecalID == id
  select s).FirstOrDefault();
  HttpRequest request = System.Web.HttpContext.Current.Request;
  if (request.Files.Count > 0)
  {
  string path = HttpContext.Request.MapPath(UserSpecialRootVirtual(special.User, special.SpecalID));
  string fileName = System.IO.Path.GetFileName(request.Files[0].FileName);
  request.Files[0].SaveAs(path + fileName);
  TempData["message"] = "上传成功";
  return RedirectToAction("Details/" + special.SpecalID);
  }
  TempData["message"] = "上传失败";
  return View(special);
  }



图片文档都行 就是不能 MP3


------解决方案--------------------
是不是系统限制上传4M文件的选项没打开啊
------解决方案--------------------
有可能


<configuration>
<system.web>
<httpRuntime maxRequestLength="32768" />
</system.web>
</configuration>

maxRequestLength: Optional Int32 attribute.
Specifies the limit for the input stream buffering threshold, in KB. This limit can be used to prevent denial of service attacks that are caused, for example, by users posting large files to the server.
The default is 4096 (4 MB).

参考:
http://msdn.microsoft.com/en-us/library/e1f13641(VS.80).aspx