Skip to content
Advertisement

How to save image on server sent with POST ajax

I am sending the image through $_POST with ajax to my script. In the $_POST array it shows like:

JavaScript

My javascript looks like:

JavaScript

How should I extract it ? I can do it if it’s in $_FILES but seems like I don’t know how to manage it this way.

Advertisement

Answer

Try by passing dataType: 'json', & cache: false, into Ajax Call.

Also Add in your form tag enctype="multipart/form-data"

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement