Filter asset factory uploads to allow only images

vruppert's Avatar

vruppert

01 Oct, 2010 05:44 PM

I am trying to set up a specific file upload using an asset factory so it will only allow images to be uploaded but I am having problems with the "File Limit" plugin. It seems no regular expression that I try setting Filename Regex to works, even a simple (jpg|gif|png)$ doesn't allow a filename person.jpg through. Upon trying to upload I get the error:

An error occurred during creation: The filename must match the following syntax: (jpg|gif|png)$

I haven't been using Cascade Server that long, so maybe there is another way to force users to uploading image files to a specific folder? I plan on setting another one of these up for document files.

  1. 1 Posted by vruppert on 01 Oct, 2010 05:48 PM

    vruppert's Avatar

    The first half of my post got cut off for some reason:

    I am trying to set up a specific file upload using an asset factory so it will only allow images to be uploaded but I am having problems with the "File Limit" plugin. It seems no regular expression that I try setting Filename Regex to works, even a simple (jpg|gif|png)$ doesn't allow a filename person.jpg through. Upon trying to upload I get the error:

    An error occurred during creation: The filename must match the following syntax: (jpg|gif|png)$

  2. 2 Posted by vruppert on 01 Oct, 2010 05:49 PM

    vruppert's Avatar

    And it got cut off again:

    I am trying to set up a specific file upload using an asset factory so it will only allow images to be uploaded but I am having problems with the "File Limit" plugin. It seems no regular expression that I try setting Filename Regex to works, even a simple (jpg|gif|png)$ doesn't allow a filename person.jpg through. Upon trying to upload I get the error:

  3. 3 Posted by stonema on 01 Oct, 2010 07:07 PM

    stonema's Avatar

    Vince,

    Try this regular expression. It dictates the format of the file's system name and the file extension but you can take the system name portion off and it should still work.

    ([a-z0-9-])+.(jpg|jpeg|gif|png)

  4. 4 Posted by vruppert on 08 Oct, 2010 02:52 PM

    vruppert's Avatar

    This works now. I was entering a system name since it had a "required" mark next to it, not aware that if I leave it blank the system name will be filled in with the file name. The File Limit plugin does not check for the file name, only the system name, so putting in "test image" did not match the regex.

  5. Tim closed this discussion on 11 Oct, 2010 07:09 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac