Reading list Switch to dark mode

    Send Images through ajax

    1. In this tutorial we are going to tell you that how to send an image through ajax to process.

    2. In the following code you can process image as soon as it is selected.

    3. First  You need to Select image file through following line of html code

    <input type="file" id="image_to_upload"/>

    4. After that you need to write the following jQuery code to catch this event.

    <script type="text/javascript">
    	jQuery.noConflict();	
    	formdata = new FormData();		
    	jQuery("#image_to_upload").on("change", function() {
    		var file = this.files[0];
    		if (formdata) {
    			formdata.append("image", file);
    			jQuery.ajax({
    				url: "destination_ajax_file.php",
    				type: "POST",
    				data: formdata,
    				processData: false,
    				contentType: false,
    				success:function(){}
    			});
    		}						
    	});	
    </script>

    5. In the destination ajax file you can access image by the following variable

    Start your headless eCommerce
    now.
    Read More
    $_FILES["image"]["name"]

    6.That is it Save And Enjoy!!

    . . .
    Add a comment

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    Be the first to comment.

    Back to Top
    I really appreciate the quality of support they are very helpful I recommended this powerful module best solution with excellent support.
    Rzouga Aloui
    Manager
    www.wamia.tn
    Talk to Sales

    Global

    Live Chat

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home