Open Sz2014 opened 10 years ago
am trying to add filed to upload multiple files using the Dialog
I added that already and I can see the uploaded files field but it dosnet upload the files. what am doing wrong?
image of the Dialog:
here the code :
UplodedFiles: { title: 'Uploded Files', type: 'file', input: function (data) { return '<form target="iframeTarget" class="formUploadFile" action="Upload" method="post" enctype="multipart/form-data"> <input type="file" onchange="this.form.submit()" name="myFile"/> </form> <iframe class="upload-iframe" style="display: none;" src="#" name="iframeTarget"></iframe>'; },
My Action Methoed:
[HttpPost] [AcceptVerbs(HttpVerbs.Post)] public ActionResult Upload() { string upload_dir = Server.MapPath("~/app_data/Uploded/"); foreach (string f in Request.Files.Keys) { if (Request.Files[f].ContentLength > 0) { //System.IO.File.SetCreationTime(Server.MapPath("~/App_Data/Uploded/" + Request.Files[f].FileName), DateTime.Now); Request.Files[f].SaveAs(upload_dir + System.IO.Path.GetFileName(Request.Files[f].FileName)); //Project.UplodedFiles += Request.Files[f].FileName + '#'; //_db.Entries.Add(Project); //_db.SaveChanges(); } } return RedirectToRoute(new { Action = "Index", Controller = "Projects" }); }
Did you ever figure this out? I'm trying to implement something like this
am trying to add filed to upload multiple files using the Dialog
I added that already and I can see the uploaded files field but it dosnet upload the files. what am doing wrong?
image of the Dialog:
here the code :
My Action Methoed: