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();
}