我正在使用dropzonejs和Laravel到我的服务器。我希望得到文件的顺序,如文件的顺序1.jpg,2.jpg,3.jpg,4.jpg,5.jpg或我在dataabse中有一个字段名称顺序。我想在数据库中保存订单
我的代码:
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);
}
}
}