srs81 / CakePHP-AjaxMultiUpload

CakePHP 2 plugin to allow for easy multi-file upload with AJAX
Other
65 stars 32 forks source link

Restricted upload of file types #15

Closed alexgenovese closed 12 years ago

alexgenovese commented 12 years ago

Hello, first of all I want to say thanks to create this plugin.

How can I set one kind of file to upload (for example only PDF) ?

Thanks -A

srs81 commented 12 years ago

Yup, in the /Vendor/valums/upload.php file, look for lines 62-63:

class qqFileUploader {
    private $allowedExtensions = array();

You can specify the extensions you want to allow in the array, so something like this:

    private $allowedExtensions = array("gif", "jpg", "pdf");

More documentation at the Valums' uploader project site (which is what is used for the uploading functionality): https://github.com/valums/file-uploader

Please note that I haven't tested this, but I think it should work since my changes to the Valums' uploader were minimal (just to get it working on CakePHP).