Question

I am using the jQuery file upload plugin. Everything is fine, except I am not able to empty the uploaded file list.

I found someone suggested using $("table#img tbody.files").empty();. I downloaded the Basic Plus UI demo to test this solution. It could temporally clear the list, but when I refreshed my page, the file list came back again.

I am wondering whether there is a way to clear the list. Thanks

Was it helpful?

Solution

I think I solved my problem, comment out the following codes in "UploadHandler.php".

protected function get_file_objects($iteration_method = 'get_file_object') {
    $upload_dir = $this->get_upload_path();
    if (!is_dir($upload_dir)) {
        return array();
    }
    return array_values(array_filter(array_map(
        array($this, $iteration_method),
        scandir($upload_dir)
    )));
}

By doing this, you won't get any file lists after refreshing the page or running $("table tbody.files").empty(); manually.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top