Upload file in sample Doc

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’);

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.dialog.alert(JSON.stringify(data), "SUCCESS");
        console.log( "SUCCESS" );
        console.log( data );
      error: function( error ) {
        // Hide Preloader
        console.log( "ERROR" );
        app.dialog.alert(JSON.stringify(error), "ERROR");
        console.log( error );

Thank you in advance

Hello! did you solve this problem? I’m looking for a solution

Делаете обычную форму и добавляете class=“form-ajax-submit”:
<form action="index.html" enctype="multipart/form-data" method="POST" class="form-ajax-submit">

в форму вставляете <input type="file">