Is there an easy way to limit the size of binary files

Is there a validation rule or setting to limit the size of binary file attachments for the file content type?

We are using 6.1

There are a couple of ways to do this…

In the old (Rhythmyx 5.5) PSO toolkit, which still runs on 6.x, there is an extension for this purpose named “PSOFileUploadValidation”, which can be used to limit the file types and maximum size on a file upload.

Because it’s an “old style” Validation extension, it will not show up in the list of Validation extensions. The JavaDoc that came with the toolkit gives instructions on how to install it.

However, if you don’t have the old PSO toolkit, there is a system extension named “sys_UploadFileAttrs”. It can be added to the “preprocessing” tab of the content type (click on the “properties” tab of the content type).

Since it wasn’t written as a validation exit, you’ll have to figure out what the parameter names are for your content type. The last parameter is the “max size”.

I am still strugling with installing the new PSOToolkit so I tried the sys_UploadFileAttrs.

I added it as pre-Procesing exension and set the names of the file upload input and the filesize input and the maxsize in bytes

But nothing happens. So not sure what to try now.

Why are all the usefull functions that are only found in the PSOTool kit not incorporated into the product? It would make life a lot easier.

When you say ‘nothing’ happens, do you mean that the 2 html parameters you specified have no values after submitting a file? Or just that the max file size validation isn’t working?

That max file size validation isn’t working

This code is very simple. I tested it on 6.5.2 and it works fine. Can you attach a screen shot of the dialog showing the params as you configured them for the exit and also the value written to the file size parameter?
The only reason validation should fail is if the text entered for the maxsize cannot be converted to a long (in this case, the validation is skipped w/o any indication.)

Hi Paul,

Typicaly I had removed it so went back to add it again to get a screen shot and this time it works. Not sure what I had done wrong last time.

The error message is not very gracefull but as dave mentioned it is not designed as a validator.

Thanks for your help


There’s an easier way to do this. If you are using the standard file content type (or your content type has the sys_FileInfo or sys_ImageInfoExtractor pre-exit), then you can do the following.

All you need to do is add a field ‘Range’ validation onto the <uploadedFileField>_size field with the max size you want. If you don’t have these other exits on your type, you could also use the exit mentioned in this thread, but leave out the max validation param. Then add the Range validation onto that field. This will behave as you desire.

Cheers Paul

That works perfectly