Last active
June 15, 2016 07:29
-
-
Save gideondsouza/4284335 to your computer and use it in GitHub Desktop.
Example for this article:www.gideondsouza.com/blog/ajax-upload-files-with-asp.net-mvc-and-uploadify
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@{ | |
Layout = null; | |
} | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="width=device-width" /> | |
<title>::Uploadify Example::</title> | |
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script> | |
<script type="text/javascript" src="@Url.Content("~/Scripts/jquery.uploadify-3.1.min.js")"></script> | |
<link rel="stylesheet" type="text/css" href="@Url.Content("~/Content/uploadify.css")" /> | |
<script type="text/javascript"> | |
$(function () { | |
$('#file_upload').uploadify({ | |
'swf': "@Url.Content("~/Content/uploadify.swf")", | |
//this is where the file posts when it uploads. | |
'uploader': "@Url.Action("Upload", "Home")", | |
'onUploadSuccess' : function(file, data, response) { | |
//data is whatever you return from the server | |
//we're sending the URL from the server so we append this as an image to the #uploaded div | |
$("#uploaded").append("<img src='" + data + "' alt='Uploaded Image' />"); | |
} | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<div> | |
Click Select files to upload files. | |
<input type="file" name="file_upload" id="file_upload" /> | |
</div> | |
<div id="uploaded"> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment