У меня проблема с удалением файлов, это потому, что имена файлов в форме dropzone отличаются от имен в папке.и из-за этого я не могу удалить изображение.но если имя изображения совпадает, я могу удалить его.

, если вы спросите, почему имя меняется?потому что я автоматически изменил имя на моем контроллере.
мой контроллер
public function create(){
if (!empty($_FILES)) {
$config['upload_path'] = $this->upload_path;
$config['allowed_types'] = 'jpg|jpeg|png|gif';
$new_name = time().$_FILES["file"]['name'];
$config['file_name'] = $new_name;
$config['width'] = 900;
$config['height'] = 600;
$this->load->library('upload',$config);
$this->upload->initialize($config);
if($this->upload->do_upload('file')){
$uploadData = $this->upload->data();
$foto = $uploadData['file_name'];
}
}
public function remove()
{
$file = $this->input->post("file");
if(file_exists($this->upload_path.$file)) {
unlink($this->upload_path.$file);
}
}
}
мой javascript
Dropzone.autoDiscover = false;
var myDropzone = new Dropzone("#dropzoneForm", {
url: "<?= base_url() ?>backend/galeri/create",
acceptedFiles: "image/*",
addRemoveLinks: true,
removedfile: function(file) {
var name = file.name;
$.ajax({
type: "post",
url: "<?= base_url() ?>backend/galeri/remove",
data: { file: name },
dataType: 'html'
});
var previewElement;
return (previewElement = file.previewElement) != null ? (previewElement.parentNode.removeChild(file.previewElement)) : (void 0);
}
});
моя форма
<form action="<?= base_url() ?>backend/galeri/create" class="dropzone" id="dropzoneForm" enctype="multipart/form-data">
</form>