2011-10-20 3 views
0

MVC3 및 Uploadify로 어떤 일이 일어나고 있는지 자세히 알지 못합니다. 아래 페이지에서 여러 파일을 업로드 할 수 있도록 허용해야합니다. 그건 지금까지 작동합니다. 파일을 업로드 할 수 있으며 서버에 저장됩니다. 문제는 업로드 한 파일의 목록 요약으로 페이지를 다시로드해야합니다. 이것은 asp.net webforms의 포스트 백과 비슷합니다. 컨트롤러를 얻는 방법 업로드 후 액션을 실행 하시겠습니까?

@model Tangible.Models.UploadViewModel 

     <input id="uploadfile" name="uploadfile" type="file" class="uploadify" /> 

The template provided outlines the upload headings and format for Disposed Assets, Leased, Loaned, Rented, and Business Assets. 

The files must be uploaded in Microsoft Excel format following the templates provided. Each template must be a separate worksheet within the Excel file being uploaded. Prior to uploading, please review the template in Excel format which requires all headings be located in row one. Do not use commas in numeric fields but the decimal place character “.” is required when indicating cents. If you have any questions or concerns regarding the format please contact our Tangible Personal Property Department at 941.861.8291. 

Note: Summary schedule item 21.- Pollution Control Equipment must be accompanied by the current DEP certificate for the reported equipment. (Please include an upload for a DEP Certificate) 



     <script type="text/javascript"> 
      $(document).ready(
      function() { 
      @{ var auth = Request.Cookies[FormsAuthentication.FormsCookieName] == null ? string.Empty : Request.Cookies[FormsAuthentication.FormsCookieName].Value;} 
       var auth = "@auth"; 
       var ASPSESSID = "@Session.SessionID";     

       $(".uploadify").uploadify({ 
        'uploader': '@Url.Content("~/Scripts/uploadify.swf")', 
        'cancelImg': '@Url.Content("~/Images/cancel.png")', 
        'buttonText': 'Upload', 
        'script': '@Url.Content("~/Wizard/Upload")', 
        'fileDesc': 'Files', 
        'fileExt': '*.*', 
        'auto': true, 
        'scriptData': { ASPSESSID: ASPSESSID, AUTHID: auth} 
       }); 
      } 
     ); 

      </script> 

은 - 컨트롤러 조치 : 모든 파일이

[HttpPost] 
     public ActionResult Upload(HttpPostedFileBase FileData) 
     { 
      var saveLocation = Path.Combine(Server.MapPath("\\"), "returns\\" + DR405Profile.CurrentUser.TangiblePropertyId); 
      System.IO.Directory.CreateDirectory(saveLocation); 
      FileData.SaveAs(Path.Combine(saveLocation, FileData.FileName)); 
      ViewData["UploadStatus"] = String.Format("File name: {0}, {1}Kb Uploaded Successfully.", FileData.FileName, (int)FileData.ContentLength/1024); 
      return View(); 
     } 

답변

1

당신은 클라이언트의 onAllComplete 이벤트를 구독 할 수 있습니다를 다시 게시하고 당신이 원하는 무엇이든에 업로드 한 후 어떻게 든 마지막 단계를 수행 할 필요 그곳에. 예를 들어 현재 URL을 새로 고침하고 AJAX 요청을 보내어 URL의 일부만 새로 고침 할 수 있습니다 ... documentation을 살펴보면 흥미로운 옵션과 이벤트를 찾을 수 있습니다.

관련 문제