javascript - File uploader using jquery ajax -
i want upload file using jquery, getting exception saying undefined not function
@ $('#myfile').ajaxform({
html
<html> <head> <meta charset="iso-8859-1"> <title>insert title here</title> <script src="jquery-1.11.1.min.js"></script> <script src="x.js"></script> </head> <body> <form enctype="multipart/form-data" action="/fileuploadui5/upload" method="post" id="myfile"> <input type=file name=upfile><br> <input type="submit" name="upload" value="upload" id="ubutton" /> </form> </body> </html>
x.js
$(document).ready(function() { $(function() { $('#myfile').ajaxform({ beforesend : function() { }, uploadprogress : function(event, position, total, percentcomplete) { alert(position + "|" + total + "|" + percentcomplete); }, complete : function(xhr) { // status.html(xhr.responsetext); } }); }); $('#ubutton').click(function(e) { $('#myfile').submit(); }); });
i believe sending files not available in pure jquery. did few days ago using plugins; http://rubaxa.github.io/jquery.fileapi/ or https://github.com/blueimp/jquery-file-upload
the first 1 impressive; able in no time , visual progress indicatior , ability use webcam images astonishing.
more in topic can find here, think: how can upload files asynchronously?
hope helps :-)
Comments
Post a Comment