2

I'm using jquery jQuery File Upload by Blueimp (http://blueimp.github.io/jQuery-File-Upload/) and I have a question:

I use this plugin to enable the user to load files on a web dir but it is important that any user can only see or delete existing files. How can I hide existing files?

Here my page: http://www.sgagrafica.com/file_uploader2/

2 Answers 2

5

I have found a solution. In file ../server/php/UploadHandler.php we have this function around line 319

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)
        )));
    }

Comment or delete this function and any files are shown after user reload page or new userr access to page.

On this way is possible only upload files according to my question.

I hope this will be usefull to someone.

Sign up to request clarification or add additional context in comments.

1 Comment

This one helped me a lot. However, I would like to rewrite the function suiting my own requirement
-1
protected function initialize() {
    switch ($this->get_server_var('REQUEST_METHOD')) {
        case 'OPTIONS':
        case 'HEAD':
            $this->head();
            break;
        case 'GET':
            // $this->get($this->options['print_response']); <-- comment this line
            break;
        case 'PATCH':
        case 'PUT':
        case 'POST':
            $this->post($this->options['print_response']);
            break;
        case 'DELETE':
            $this->delete($this->options['print_response']);
            break;
        default:
            $this->header('HTTP/1.1 405 Method Not Allowed');
    }
}

1 Comment

Please see this first how-to-answer This question is answered before, obviously, you can add your answer here. But You Need to understand some points before answering. First, don't add an answer which is previously added with the same code or suggestion. Second, don't add an overly complicated answer if the user has asked very specifically about the problem and what he needs to solve this. Third, You can add a comment if you want to suggest anything regarding the answer or question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.