Closed kenwinans closed 9 years ago
Thanks for the feedback!
Good point - the setAllowedExtensions() would be really helpful. I think there was another issue about this as well.
Do you have time to issue a pull request to allow for this? If not, I can work on this as soon as I can.
Actually, as I dug into this more deeply, I realized it is a bit of a tricky problem. The array allowedExtensions is in the UploadsController, not in the component. The UploadsController is invoked when the method upload() is called from the AJAX script from the client browser and is a completely separate instance from my TracksController that uses the AjaxMultiUpload component.
It seems to me that anything that is set in the component is gone when the instance of the UploadsController is invoked. I thought about using a cookie or session to store the values but did not pursue it. I haven't even forked the project to try something yet.
Maybe you have a better perspective on this than me. If you have a suggestion, I'll be happy to try whatever it is you suggest.
Ken
I've added the feature to let you set allowed file types to upload in the controller, as a parameter in this->Upload->edit() . Can you check if it works fine now?
First, let me thank you for your fine plugin.
Second, I'm new to GitHub so maybe this is not the proper place for this, but...
I would like to be able to modify the list of allowedExtensions from within the controller that I have attached the AMU component to.
I have a working installation but in my Tracks controller I want to restrict the file types to ".mp3" files and in the Images controller I want only ".jpg" or ".png" files.
In my Tracks controller I have tried to accomplish this by putting the following line in my beforeFilter() function as follows: $this->Upload->allowedExtensions = array('mp3');
It has no effect.
Conversely, when I edit the AMU UploadsController.php file like this: protected allowedUploads = array('mp3'); I get the expected result - i.e. when trying to upload a file other than mp3, an error is issued.
Should there be a setAllowedExtensions() method in UploadCompnent?
Any suggestions?
Thanks, Ken