Load images to server from mobile site -
i developing mobile site using asp.net , jquery. no plugin. simple jquery.
i using
<input type="file"/>
of html5.
so few questions big picture:
1.can load files without jquery plugin, simple jquery? picking file, send using ajax , catch on server side?
2. have noticed request.files attribute of request object. filled post of whole page or can files there using ajax?
3.in case answer in 2 "no!", how exclude files data on server side?
thanks
this solution have found:
js:
<script type="text/javascript"> $(document).ready(function () { $('#inputfile').on('change', function () { var file = this.files[0]; var name = file.name; var size = file.size; var type = file.type; var formdata = new formdata(); formdata.append(file.name, file) $.ajax({ url: 'ajaxpage.aspx', datatype: 'script', cache: false, contenttype: false, processdata: false, data: formdata, type: 'post', success: function (response) { alert(response); }, error: function (e) { alert(e); } }); }); }); </script>
cs: (on ajax page catch files , manipulate them will)
var files = request.files;
html:
<body> <div> <input type="file" id="inputfile" /> </div> </body>
Comments
Post a Comment