@bribin Are you intending to upload multiple images for the same order? If so do you have a model for these images?
Sep 18, 2015
7
Level 1
DropzoneJs files save order as filename to database laravel 5
I am working on a project which involves file uploading. I am using DropzoneJS and Laravel for this project. Everything seems to work fine, i want to save files with order.i want to pass the image order and save image file in that order.
var baseUrl = "{{ url('/') }}";
var token = "{{ Session::getToken() }}";
Dropzone.autoDiscover = false;
var myDropzone = new Dropzone(".dropzone", {
url: baseUrl + "/upload",
params: {
_token: token
}
});
Dropzone.options.myAwesomeDropzone = {
paramName: "flyers",
acceptedFiles: "image/*",
enqueueForUpload: true,
forceFallback: false,
dictDefaultMessage: "Drop files here to upload",
autoProcessQueue: false,
uploadMultiple: false,
maxFilesize: 2, // MB
addRemoveLinks: true,
accept: function(file, done) {
},
};
public function album()
{
$file = Input::file('file');
$destinationPath = 'uploads';
$filename = $file->getClientOriginalName();
$uploadSuccsess = Input::file('file')->move($destinationPath, $filename);
if( $uploadSuccsess ) {
return Response::json('success', 200);
} else {
return Response::json('error', 400);
}
}
Please or to participate in this conversation.