Hi guys,
could you type the code for upload one single file jpeg to a server in the right way? Not sample in the Doc for this.
In the Doc I read app.form.convertToData(’#my-form’) but I dont know if this one append the file or I need to append the file in another way. I saw only data when I tried with my script but not a file (always give me error loading file in the php server side).
My code is this one:
var formData = app.form.convertToData(’#my-form’);
app.request({
url: ‘http://myserver/file.php’,
method: “POST”,
data: formData,
cache: false,
dataType: “application/json”,
contentType: “multipart/form-data”,
processData: true,
success: function( data ) {
// Hide Preloader
app.preloader.hide();
////
app.dialog.alert(JSON.stringify(data), "SUCCESS");
console.log( "SUCCESS" );
console.log( data );
},
error: function( error ) {
// Hide Preloader
app.preloader.hide();
////
console.log( "ERROR" );
app.dialog.alert(JSON.stringify(error), "ERROR");
console.log( error );
}
});
Thank you in advance