i have multiple input, textarea and select i need multiple image upload so i try dropzone js and in controller request there is no file
i use autoProcessQueue: false and its not working but if i don’t use it upload but i don’t get data in request file
Problem is how can i get request file from dropzone
this is dropzone script
<script>
Dropzone.options.dropzone =
{
// The configuration we've talked about above
url: "{{ route('product.store') }}",
headers: {
'x-csrf-token': "{{ csrf_token() }}",
},
// autoProcessQueue: false,
uploadMultiple: true,
parallelUploads: 100,
maxFiles: 100,
// The setting up of the dropzone
init: function() {
var myDropzone = this;
var formData = new FormData();
// First change the button to actually tell Dropzone to process the queue.
$("#prodcutCreate").click(function (e){
// Make sure that the form isn't actually being sent.
var formData = new FormData(this);
e.preventDefault();
e.stopPropagation();
myDropzone.processQueue();
});
// Listen to the sendingmultiple event. In this case, it's the sendingmultiple event instead
// of the sending event because uploadMultiple is set to true.
this.on("sendingmultiple", function() {
// Gets triggered when the form is actually being sent.
// Hide the success button or the complete form.
// formData.append("name", $("#name").val());
// formData.append("slug", $("#slug").val());
// formData.append("description", $("#description").val());
// formData.append("ideal_for", $("#ideal_for").val());
// formData.append("main_ingredients", $("#main_ingredients").val());
// formData.append("gender_id", $("#gender_id").val());
// formData.append("brand_id", $("#brand_id").val());
// formData.append("categories", $("#categories").val());
});
this.on("successmultiple", function(files, response) {
// Gets triggered when the files have successfully been sent.
// Redirect user or notify of success.
console.log('success');
console.log(files);
console.log(response);
});
this.on("errormultiple", function(files, response) {
// Gets triggered when there was an error sending the files.
// Maybe show form again, and notify user of error
console.log(false);
console.log(files);
console.log(response);
});
}
}
this is controller i dd the request but no file
public function store(Request $request){dd($request); }
this is form i have other input fileds too
<form method="POST" action="{{ route('product.store') }}" enctype="multipart/form-data">
<div class="col-span-4 dropzone" id="dropzone"></div>
this is from $request
files: SymfonyComponentHttpFoundationFileBag
{#46
#parameters: []
}
thanks