2011-10-20 7 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を検索すると、興味のあるオプションや予定を見つけることができます。

関連する問題