save image coming from jquery with PHP json_encode

0

I'm having a question when I'm going to save the images coming from jquery with PHP's json_encode.

I have this jquery code to grab the images

$('#drag-and-drop-zone').dmUploader({
    url: 'upload.php',
    dataType: 'json',
    allowedTypes: 'image/*',
    /*extFilter: 'jpg;png;gif',*/
    onInit: function(){
      $.danidemo.addLog('#arquivos_cliente', 'default', 'Plugin initialized correctly');
    },
    onBeforeUpload: function(id){
      $.danidemo.addLog('#arquivos_cliente', 'default', 'Starting the upload of #' + id);

      $.danidemo.updateFileStatus(id, 'default', 'Uploading...');
    },
    onNewFile: function(id, file){
      $.danidemo.addFile('#demo-files', id, file);
    },
    onComplete: function(){
      $.danidemo.addLog('#arquivos_cliente', 'default', 'All pending tranfers completed');
    },
    onUploadProgress: function(id, percent){
      var percentStr = percent + '%';

      $.danidemo.updateFileProgress(id, percentStr);
    },
    onUploadSuccess: function(id, data){
      $.danidemo.addLog('#arquivos_cliente', 'success', 'Upload of file #' + id + ' completed');

      $.danidemo.addLog('#arquivos_cliente', 'info', 'Server Response for file #' + id + ': ' + JSON.stringify(data));

      $.danidemo.updateFileStatus(id, 'success', 'Upload Completes');

      $.danidemo.updateFileProgress(id, '100%');
    },
    onUploadError: function(id, message){
      $.danidemo.updateFileStatus(id, 'error', message);

      $.danidemo.addLog('#arquivos_cliente', 'error', 'Failed to Upload file #' + id + ': ' + message);
    },
    onFileTypeError: function(file){
      $.danidemo.addLog('#arquivos_cliente', 'error', 'File \'' + file.name + '\' cannot be added: must be an image');
    },
    onFileSizeError: function(file){
      $.danidemo.addLog('#arquivos_cliente', 'error', 'File \'' + file.name + '\' cannot be added: size excess limit');
    },
    /*onFileExtError: function(file){
      $.danidemo.addLog('#arquivos_cliente', 'error', 'File \'' + file.name + '\' has a Not Allowed Extension');
    },*/
    onFallbackMode: function(message){
      $.danidemo.addLog('#arquivos_cliente', 'info', 'Browser not supported(do something else here!): ' + message);
    }
});

I get the status with PHP json_encode

echo json_encode(array('status' => 'ok'));

How would I get the name of each uploaded image, so that I can then write to a folder?

    
asked by anonymous 27.09.2017 / 14:42

0 answers