我正在尝试使用Fine Uploader包将多个文件上传到laravel项目中的S3存储桶。
我已经实现了提供的Example Controller,但是上传失败,我花了数小时试图找出原因
我遇到以下错误
Successfully parsed some EXIF tags
POST http://localhost:8000/uploader 419 (unknown status)
POST request for 0 has failed - response code 419
Response does not include the base64 encoded policy!
Policy signing failed. Response does not include the base64 encoded policy!
Simple upload request failed for 0
路线
Route::post('/uploader', 'S3UploadController@endpoint')->name('uploader');
前端
var s3Uploader = new qq.s3.FineUploader({
debug: true,
element: document.getElementById('fine-uploader-s3'),
template: 'qq-template-s3',
request: {
endpoint: "BUCKET.s3.eu-west-2.amazonaws.com",
accessKey: "PUBLIC KEY"
},
signature: {
endpoint: "{{route('uploader')}} "
},
uploadSuccess: {
endpoint: "/uploader?success",
params: {
isBrowserPreviewCapable: qq.supportedFeatures.imagePreviews
}
},
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
iframeSupport: {
localBlankPagePath: "/fine-uploader/success.html"
},
cors: {
expected: false
},
chunking: {
enabled: false
},
resume: {
enabled: true
},
deleteFile: {
enabled: true,
method: "POST",
endpoint: "uploader?deleteObject"
},
validation: {
itemLimit: 5,
sizeLimit: 15000000
},
thumbnails: {
placeholders: {
notAvailablePath: "/fine-uploader/not_available-generic.png",
waitingPath: "/fine-uploader/waiting-generic.png"
}
},
callbacks: {
onComplete: function(id, name, response) {
var previewLink = qq(this.getItemByFileId(id)).getByClass('preview-link')[0];
if (response.success) {
previewLink.setAttribute("href", response.tempLink)
}
}
}
});
请帮助我,我要疯了:(
答案 0 :(得分:0)
您是否尝试过Laravel File System方法?
使用本地或s3上传文件更加灵活。
答案 1 :(得分:0)
我没有设法使Fine Uploader正常工作,所以我改用PL Upload,它的工作效果很好:)