php - Dropzone JS add Remove Button -
sorry im stil newbie dropzone, need create remove button dropzone js after file success upload tried using
if(typeof dropzone != 'undefined') { dropzone.autodiscover = true; $(".dropzone[action]").each(function(i, el) { $(el).dropzone(); }); dropzone.createelement("<button>remove file</button>"); }
the remove button still not show on buttom of tumbnails. page :
<form action="data/upload-file.php" class="dropzone"></form>
my php upload file
<?php header('content-type: application/json'); #$errors = mt_rand(0,100)%2==0; // random response (demo purpose) $errors = false; $resp = array( ); # normal response code if(function_exists('http_response_code')) http_response_code(200); # on error if($errors) { if(function_exists('http_response_code')) http_response_code(400); $resp['error'] = "couldn't upload file, reason: ~"; } echo json_encode($resp);
i success @pddong add "addremovelinks: true"
if(typeof dropzone != 'undefined') { dropzone.autodiscover = false; var mydropzone = new dropzone("#mydropzone", { url: "data/upload-file.php", maxfilesize: 50, acceptedfiles: ".pdf", addremovelinks: true, //more dropzone options here }); } };
and page this
<form action="data/upload-file.php" class="dropzone" id="mydropzone"></form>
Comments
Post a Comment