Level 1
NO any idea?
I am working with laravel 5.6. and using dropzone with pragmatically. my dropzone div is like this,
<div class="dropzone" id="my-dropzone">
<div class="dz-message">
<div class="col-xs-8">
<div class="message">
<p>Drop files here or Click to Upload</p>
</div>
</div>
</div>
<div class="fallback" id="fallback">
<input type="file" name="file" multiple>
</div>
</div>
and
Dropzone.autoDiscover = false;
// Dropzone class:
var myDropzone = new Dropzone("div#my-dropzone", { url: '/form'});
and My image store Controller is
public function store(Request $request)
{
$photos = $request->file('file');
dd($photos);
if (!is_array($photos)) {
$photos = [$photos];
}
if (!is_dir($this->photos_path)) {
mkdir($this->photos_path, 0777);
}
for ($i = 0; $i < count($photos); $i++) {
$photo = $photos[$i];
$name = sha1(date('YmdHis') . str_random(30));
$save_name = $name . '.' . $photo->getClientOriginalExtension();
$resize_name = $name . str_random(2) . '.' . $photo->getClientOriginalExtension();
Image::make($photo)
->resize(250, null, function ($constraints) {
$constraints->aspectRatio();
})
->save($this->photos_path . '/' . $resize_name);
$photo->move($this->photos_path, $save_name);
$upload = new Upload();
$upload->filename = $save_name;
$upload->resized_name = $resize_name;
$upload->original_name = basename($photo->getClientOriginalName());
$upload->save();
}
return Response::json([
'message' => 'Image saved Successfully'
], 200);
}
but when I use input with this div
<div class="fallback">
<input type="file" name="file" multiple>
</div>
multiple images uploading is not working dd(photos); is occurred null value. but without above div class single image upload is working. what is the error how can fix this problem?
Please or to participate in this conversation.