samedi 17 octobre 2015

Dropzone Internal server error (500) only on ubuntu

I'm facing a weird problem. I'm using dropzoneJS in my laravel project and the thing is on my laptop (OS X + homestead) everything works just fine but on another laptop (windows 10 + VMware with Ubuntu) drop zone just don't want to work. Both are using the exactly same project, cloned by our github repo. If I try to upload any photo on the mac, the process succeds every single time, but if we try to perform the upload on ubuntu, we keep getting the same error on the browser console: POST ('upload/photo') 500: internal server error on dropzone.js line 1347.
This is the dropzone.js incriminated line : return xhr.send(formData);.

Here's my dropzone customisation:

Dropzone.autoDiscover = false;


Dropzone.options.dropzoneForm = {
  uploadMultiple: false,
  parallelUploads: 1,
  addRemoveLinks: true,
  dictRemoveFile: 'Rimuovi Foto',
};


var dropzoneForm = new Dropzone("#dropzone-form", {
    /* post url */
    url: 'upload/photo',

    autoProcessQueue : false,
});


dropzoneForm.on("processing", function() {
    dropzoneForm.options.autoProcessQueue = true;
});


dropzoneForm.on('success', function(file, response){
  console.log(response.filepath);
});


dropzoneForm.on('queuecomplete', function(){
  dropzoneForm.options.autoProcessQueue = false;
});  

The controller grabs the POST data

$photo = $request->file('file');  

and eventually it performs the upload

$destinationPath = public_path('photo/'); 
$extension = '.' . $photo->getClientOriginalExtension();  
$fileName = $this->sanitize(str_replace($extension, "", $photo->getClientOriginalName())); 
$uniqueFileName = $this->createUniqueFileName($fileName, $extension); 
$upload = $this->resizeAndWatermarkUpload($photo, $uniqueFileName, $destinationPath);  


        if ($upload) {
            return Response::json([
                    'error' => false,
                    'code'  => 200,
                    'filepath' => $uniqueFileName
                ], 200);
        } else {
            return Response::json([
                'error' => true,
                'message' => ' Upload Error',
                'code' => 500
            ], 500);
        }  

I tried to upload some photo even outside homestead, using the laravel built in server, and again, it works on the mac but not on ubuntu.
I'm trying to figure out why is this happening but I can't really make it up. Maybe something related to the php version? Any help will be greatly appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire