lavina
1 month ago
100
0
Laravel

Working around 2 forms with dropzonejs

Posted 1 month ago by lavina

Hello guys,

i am attempting to use the dropzonejs library to make multiple file drop with preview quickly.

But I ran into a problem that I'm not sure how to workaround. I end up creating 2 forms and that of course cant happen. The main blade:

<form method="post" action="{{ ($action) }}" enctype="multipart/form-data">
                <input name="_token" type="hidden" value="{{ csrf_token() }}"/>
                @foreach($fullList as $list)
                    @php $data = $list->toArray(); @endphp
                    @foreach($data as $key => $value)
                            @if($key == 'logo')
                                <div class="col-sm-9">
                                    @include('uploadFile')
									</form>

And then I have the dropzonejs on the blade uploadFile:

<div class="container-fluid">
    <div class="panel-body">
        <form id="dropzoneForm" class="dropzone" action="{{ route('dropzone.upload') }}">
            @csrf
        </form>
        <div align="center">
            <button type="button" class="btn btn-info" id="submit-all">Upload</button>
        </div>
    </div>
</div>

This makes 2 forms and cant work, but also I am unable to make the dropzoneForm without making it a form, how can it be done?

Please sign in or create an account to participate in this conversation.