as the title describes i would like to create an image upload with ajax with jQuery. As far as I know right now, there is no image ajax uploading. Workarounds are iframes and flash. Since i don't like flash, i'm fine with the iframe hack, i hope. Like they do it here: http://tinyw.in/UNnp
I have an element. I want to make it possible, to double click on the element, then a file browser appears, you choose your image, it gets uploaded and the image's src you just clicked get's changed to the new uploaded image's path. Doesn't really sound that hard.
Actually, that's what the link i posted above does. I don't know what it does in detail, how it handels everything, since there is no documentation.
So, can me anyone explain what that plugin does in the backend, so i understand it. I don't know what i should do with the php.php file, what i should pass as an action of the form.
Thanks
jQuery AJAX image upload requires core jQuery features and nothing fancy is used. For AJAX image upload, enctype='multipart/form-data' is not required as we are not submitting via form post. We are using AJAX data transfer and multipart form data is not required for the image upload.
button('loading'); var data = $('#first-form'). serialize(); var formData = new FormData(); formdata. append("img", fileImage ); $. post("/Contractor/SendConfirmCode", data, function(result) { } else { } }, "json");
http://jquery.malsup.com/form/ this plugin is very nice. Just create a form, init the plugin with it and you are done. Just handle the uploaded files within PHP's $_FILES[]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With