Bribin
888
2
General

Dropzone js + File Upload File Order

Posted 3 years ago by Bribin

Hi, Im developing a project with Dropzone file upload, i want to pass the order of dropone file into data base , how i can save the order/position of the file in database

    $file = Input::file('file');
        $campaign =  Campaign::getCampaign($id);
           
        $uploadPath = 'uploads/stores/'.$campaign->store->id.'/'.$id.'/';
        $destinationPath = '/uploads/stores/'.$campaign->store->id.'/'.$id.'/';
        $filename = $id .'-'.$campaign->store->id.$file->getClientOriginalName();
        $upload_success = Input::file('file')->move($uploadPath, $filename);

            if ($upload_success) {
                    // resizing an uploaded file
                $thumb = Image::make($uploadPath.$filename)->resize(184, NULL,  function ($c) {
                    $c->aspectRatio();
                    $c->upsize();
                });
                $thumb->save($uploadPath.'thumb_'.$filename);
            }

        $campaign->flyers()->create(
                 ['path' => $destinationPath.$filename, 'order'=> $i ,'thumbnail'=>    $destinationPath.'thumb_'.$filename]
        );
    return  'success';

dropzone .js config

     Dropzone.options.addflyer = { 
         uploadMultiple: false,
            parallelUploads: 1,
         maxFilesize: 8,
         autoProcessQueue: false,
            addRemoveLinks: true,
            dictRemoveFile: 'Remove',
            dictFileTooBig: 'Image is bigger than 8MB',
              
             };

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