Reputation: 266
Sorry im stil newbie from dropzone, I need create Remove Button From Dropzone JS after file success Upload i was 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. my 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);
Upvotes: 1
Views: 4275
Reputation: 266
i was success thanks @pddong by 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 the page be like this
<form action="data/upload-file.php" class="dropzone" id="myDropzone"></form>
Upvotes: 5