It looks like you're new here. If you want to get involved, click one of these buttons!
@{
ViewBag.Title = "Home Page";
}
@section Head
{
<link href="@Url.Content("~/Uploadify/uploadify.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Uploadify/jquery.uploadify-3.1.js")" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$('#file_upload').uploadify({
'swf': '@Url.Content("~/Uploadify/uploadify.swf")',
'uploader': '@Url.Action("Upload")',
'folder': '@Url.Content("~/Content/UploadedFiles")',
'cancelImg': '@Url.Content("~/Uploadify/uploadify-cancel.png")',
'multi': false,
'buttonText': 'Browse',
'onUploadError': function (file, errorCode, errorMsg, errorString) {
alert('The file ' + file.name + ' could not be uploaded: ' + errorString);
}
});
});
</script>
}
<input type="file" name="file_upload" id="file_upload" /> [HttpPost]
public ActionResult Upload(HttpPostedFileBase FileData)
{
// Notice the argument of the MapPath method:
var fileDirectory = Server.MapPath(@"~/Content/UploadedFiles/");
FileData.SaveAs(fileDirectory + FileData.FileName);
return View("Index");
}