my issue with FilePond is when I upload multiple images it سeparates the requests, which prevents me from uploading the images to one folder.
Here is my input field:
<input type="file" id="imgs" name="imgs" accept="image/jpeg"
multiple
data-allow-reorder="true"
data-max-file-size="3MB"
data-max-files="5"
>
Here is my controller code:
public function saveTemp(Request $request)
{
if ($request->only('imgs')) {
$file = $request->file('imgs');
$fileName = $file->getClientOriginalName();
$folder = uniqid().'-'.now()->timestamp;
$file->storeAs('admin/product/tmp-images/tmp-'.$folder, $fileName);
return $folder;
}
return '';
}
there is no documentation from FilePond about file validating.
appreciate the help.
2
Answers
For validate part you can go back to @mrkazmierczak answer.
but for filepond requests that is how filepond behaves, I`ve made my own file uploader using vue.js with a live image preview.
if you want the source code feel free to ask.
If you are using only FilePond upload script without any JS framework, so you can’t use validation plugin provided with FilePond. The only way you can pass this is validation on the backend is
But think about any frontend framework and use FilePond validation plugin. This solution is more reactive. Of course you still need to validate what you have on frontend and backend at the same time, but but this is more user friendly.