Jsonp can be used to fetch data from supporting services but can i use it to upload images. As far as i understand javascript cannot access your file system making it impossible to upload an image using pure javascript techniques.However is there a work around. Can an image be uploaded to a server using jsonp?
I don't think you can just using json. The closest you can get is posting to a seperate iframe. Jquery has a feature where you can post a form to a hidden iframe.
http://aspzone.com/tech/jquery-file-upload-in-asp-net-mvc-without-using-flash/
If you are using jquery: http://plugins.jquery.com/plugin-tags/ajax-upload
Related
I am looking at a solution to display data from an external website in wordpress. The method I have been given to access the data is through an AJAX API. I have seen some articles about adding content via ajax into a plugin, but what I would like is for the data to create individual posts.Is this possible? if so what is the best way of doing this?
I'm making front-end profiler in WordPress. I want to upload user photo from front-end. My entire profile is on WordPress ajax. I simply want to upload photo to wp-content/uploads/.. but from front using ajax. I want two things:
1) Media hook
2) File to post through ajax
Can anyone help me a little. I'm really stuck in this place.
First:
For Wordpress new Media Uploader you should look to this tutorial.
Second:
To handle file uploads in Wordpress, you can use the function wp_handle_upload
Note:
You can use Form Data API to upload files with ajax but it may not work with older browsers. Instead you can do file uploads with iframe.
i want to send form data to server side via jQueryajax . i am uploading multiple images .
when i press submit button, i should send images path via ajax to server(node.js)
but here i am using form so
how to do that ?
i have tried this one.but it is not working for multiple image upload
http://blog.w3villa.com/websites/uploading-filesimage-with-ajax-jquery-without-submitting-a-form/
thing which you need to take care is cross-browser compatibility and unfortunately Formdata in not supported in Internet Explorer.
I would suggest you to use Uploadify JQuery plugin. You can download it from http://www.uploadify.com/. You can use the flash version, I have tested it and it works fine with IE as well.
Best of Luck.
I want to submit form using ajax.but the problem is that ,i found ajax doesn't support file upload while we submit form.Is there any other way we can do it using ajax because i don't want to refresh page using normal form submit.Please help any suggestion will be very helpful for me.
thanks in advance
You can do this in several ways:
First:
Use canvas
How to save a HTML5 Canvas as Image on a server
Second:
Use some js library like:
http://blueimp.github.io/jQuery-File-Upload/ or
https://github.com/LPology/Simple-Ajax-Uploader
Third:
Use html5 FormData
How to upload a file using jQuery.ajax and FormData
I've been trying to use the webimage helper in webmatrix to upload an image using ajax but its not clear to me how i can pass data to the webimage.getImageRequest("Image") method from the ajax post.This helper seems to retrieve its file upload data from the browser when the page form is posted.For me, i dont want to refresh the form...I just want ajax to handle process
The issue here isn't the WebHelper - uploaded files are not posted with ajax requests:
How can I upload files asynchronously?
So you're probably getting a file name, but no content. That thread above shows a few work arounds that should work fine with the WebHelper. I've also had pretty good luck with uploadify:
http://www.uploadify.com/
Happy Coding!