CreativeDream / php-uploader

PHP File Uploader is an easy to use, hi-performance File Upload Script which allows you to upload files to webserver
MIT License
94 stars 51 forks source link

Issue in deleting files #11

Closed aniket-singh closed 7 years ago

aniket-singh commented 7 years ago

I have set this option 'title' => array('auto', 80), This option gives me a file name like HJx9Wcyaego3rDuXY_10zv54kAlFLiGPINjSTCUhK8qtV7RQdpbMnO6fmwBsEZ2.jpg. Now due to this Whenever i click on remove button it sends it original file name as Example.jpg . Because of this I'm unable to delete that file

if(isset($_POST['file'])){
    $file = '../../assets/images/data/' . $_POST['file'];
    if(file_exists($file)){
        unlink($file);
    }
}
CreativeDream commented 7 years ago

In the demo example you will find the way.

aniket-singh commented 7 years ago

Will this function get it's new name and delete that file?

function onFilesRemoveCallback($removed_files){ foreach($removed_files as $key=>$value){ $file = '../uploads/' . $value; if(file_exists($file)){ unlink($file); } } return $removed_files; }