1
Good afternoon friends, I am making a website that the person makes the registration in my form and I, using AJAX, play the dice in the bank. I wanted to know how to save this image that the person put in the form in some variable, so that my upload file can use it once it is registered. For example:
function saveCliente(){
$.post("../setters/addLojaPainel.php", $('#form').serialize(), function (response) {
if (response.result == "1") {
doUpload(response.id);
getData();
}else{
alert(response.exception);
}
});
}
that is, when the result of the request is 1 (success) it uses doUpload, function to store the image on the server, using other data from the request. However, I don’t know how to store the image in the form.
I hope I was clear, is that the code is very extensive and would be invincible to paste here. Grateful
At the moment you send the data via POST to perform the registration, you could also send the image using a file type input. In PHP you use $_FILE['nameDoInput'] to control the uploaded file.
– Clayderson Ferreira
but I can get this variable on JS? @Claydersonferreira
– Luan Gabriel
No. But do you really need to take JS? From what I understood of your question, you could register the client and upload the image via PHP in an AJAX request.
– Clayderson Ferreira