I wouldn't try to fight Dropzone. I would:
- let it upload the files to your Laravel server as soon as they are dropped
- verify the upload is roughly what you expect
- store the files locally
- return the
pathname - store those
pathnamesas a hidden input in the form - then, when the form is completed and validated, grab those files and upload them to S3
Here is an upload() function that I have used:
public function upload(Request $request)
{
\Log::debug(__METHOD__, $request->toArray());
$response = ['status' => 'ack'];
if ($request->hasFile('file') && ($request->file->isValid())) {
$fname = sprintf("%s-%s", date('ymdhis'), $request->file->getClientOriginalName());
$stored = $request->file->storeAs('uploads', $fname);
$response['stored'] = $stored;
if ($this->checkValidUploadType($stored)) {
ImportJob::dispatch($stored); // artisan make:job ImportJob
} else {
unlink(storage_path('app/' . $stored));
abort(406, 'Unrecognized CSV header.');
}
} else {
$response['status'] = 'error: during upload';
}
return $response;
}