php - Get the current serverFilenamein dropzone? -
i getting stuck on using laravel 5.2 framework. want server filename while clicking on remove filein dropzone. have upload images. when try remove particular image give me alll images in dropzone here code:-
enter code here dropzone.autodiscover = false; var filelist = new array; var =0; $("#my-awesome-dropzone").dropzone({ method:'post', maxfiles: 10, paramname: "file", maxfilesize: 10, addremovelinks: true, acceptedfiles: ".jpeg,.jpg,.png,.gif", clickable: true, init: function() { // hack: add dropzone class element $(this.element).addclass("dropzone"); this.on("sending",function(file, xhr, formdata) { formdata.append("_token", "{{ csrf_token() }}"); }); this.on("success", function(file, serverfilename) { filelist[i] = {"serverfilename" : serverfilename, "filename" : file.name,"fileid" : }; //console.log(filelist); i++; }); this.on("removedfile", function(file) { var rmvfile = ""; for(var f=0;f<filelist.length;f++){ if(filelist[f].filename == file.name) { rmvfile = filelist[f].serverfilename; } } if (rmvfile){ $.ajax({ type: 'post', url: '../contributor/delete-subimages', data: {filenamenew: rmvfile} }); } }); }, url: '../contributor/add-subimages', });
they give me images in session:-
enter code here <pre>array ( [filenamenew] => <pre>array ( [960-2] => 9vz7jgc6r0dgbmpu46chbpqw.jpg [2368] => oemsv8jsnwsrnn7pevbxa0fe.jpg [3463] => lrvuto6dofqbaqgdsoraaiqg.jpg )
but want current image name while clicking on remove file in dropzone. delete function:-
enter code here public function deletecontributorimage(request $request){ $data = $request->all(); echo "<pre>"; print_r($data); die;
}
Comments
Post a Comment