Note that there are some explanatory texts on larger screens.

plurals
  1. POIn MVC4 file upload its saving "System.Web.HttpPostedFileWrapper" in DB instead of file name
    primarykey
    data
    text
    <p>I'm trying to do a file-upload using MVC4 but its saving object name "System.Web.HttpPostedFileWrapper" in DB instead of file name i.e. "Songs.MP3", also file is not transferred to given location.</p> <p>MODEL</p> <pre><code> public class FileUpload { [Key] public int FileUploadID { get; set; } public int AlbumID { get; set; } public string FileType { get; set; } public string FileUploadLocation { get; set; } public virtual Albums Albums { get; set; } } </code></pre> <p>View</p> <pre><code>@using (Html.BeginForm("Create", "FileUpload", FormMethod.Post, new { enctype = "multipart/form-data" })) </code></pre> <p>{ </p> <hr> <pre><code> &lt;div class="editor-label"&gt; @Html.LabelFor(model =&gt; model.FileUploadLocation) &lt;/div&gt; &lt;div class="editor-field"&gt; @Html.TextBoxFor(model =&gt; model.FileUploadLocation, new { type = "file", accept = "FileUploadLocation/*" }) @Html.ValidationMessageFor(model =&gt; model.FileUploadLocation) &lt;/div&gt; </code></pre> <p>Controller</p> <pre><code> // // POST: /FileUpload/Create [HttpPost] [ValidateAntiForgeryToken] public ActionResult Create(FileUpload fileupload, HttpPostedFileBase FileUploadLocation) { if (ModelState.IsValid) { var fileName = Path.GetFileName(FileUploadLocation.FileName); var path = Path.Combine(Server.MapPath("~/Images/Files"), fileName); FileUploadLocation.SaveAs(path); db.FileUploads.Add(fileupload); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.AlbumID = new SelectList(db.Albumss, "AlbumID", "AlbumTitle", fileupload.AlbumID); return View(fileupload); } </code></pre> <p>file is not available in ~/Images/Files location.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload