title: Sorting upload images with jQuery UI sortable and save to database
body: <pre><code>&lt;input type="file" name="uploadPhotos[]" class="upload" multiple accept='image/*' /&gt;
  &lt;div class="previewBlock" id="sortable"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>I build preview upload images with js </p>
  
  <pre><code>function handleFileSelect(evt) {
      var files = evt.target.files;
      for (var i = 0, f; f = files[i]; i++) {
          if (!f.type.match('image.*')) {
              continue;
          }
          var reader = new FileReader();
          reader.onload = (function (theFile) {
              return function (e) {
                  $('.previewBlock').append(
                      $('&lt;div/&gt;').append(
                          $('&lt;div/&gt;').append(
                              $('&lt;img/&gt;').attr({
                                  name: theFile.name,
                                  src: e.target.result,
                                  title: escape(theFile.name)
                              }).append(escape(theFile.name))
                          )
                      )
                  );
              };
          })(f);
          reader.readAsDataURL(f);
      }
  }
  $('.upload').change(handleFileSelect);
  </code></pre>
  
  <p>I work with $_FILES and save images to DB by default sorting.
  How can i send re-sorting array with upload images to PHP after jQuery UI sorting?</p>
  
  <pre><code>$("#sortable").sortable({
          start: function(event, ui) { },
          change: function(event, ui) { },
          update: function(event, ui) {
              //
          }
  $('#sortable').disableSelection();
  </code></pre>