Document Attributes - Pitch in Request

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
ACDC
Posts: 1143
Joined: Sat Jun 30, 2007 5:03 pm
Location: California, USA

Document Attributes - Pitch in Request

Post by ACDC »

Hi all

When uploading a File (Document) type, there is no way of knowing the
File Size, File Name, or File Extension in the object.

If you are doing any document storage or document handling application or special rules on the document, this information becomes important

Support have quoted me to develop a plug-in that will let you access these attributes.

The function will be just like any other function - you can use them in rules as usual.

If you are interested in Pitching in to get his function please PM me

Thank you
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

This is now possible in build 1204.

Assuming the uploaded doc is stored in Doc.DocStorage, following are 3 rules to make it work.

1) Doc.DocName=FILE_NAME(Doc.DocStorage)

2) Doc.DocExt=FILE_EXTENSION(Doc.DocStorage)

3) Doc.DocFileSize=FILE_SIZE(Doc.DocStorage)
Tom - V8.8 build 3137 - MySql / PostGres
hpl123
Posts: 2600
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

FILE_EXTENSION

Post by hpl123 »

Tom (or others),
I have tried getting the FILE_EXTENSION to work but can´t seem to get it to do what I want. I basically want to control/restrict the kinds of files users can upload. This is what I´ve tried but without success:

If Photo IS NEW AND FILE_EXTENSION(Photo.Photo)<>'png' Then
REPORT ERROR 'Photo format error. Please upload png files only'

Can you/someone please help me get this to work? Thanks
Henrik (V8 Developer Ed. - Windows)
hpl123
Posts: 2600
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Hum

Post by hpl123 »

I am maybe on to one of the causes of my error.

First of all, in my previous example I wrote png file extension, it´s really jpg I want users to upload but had some issues trying it so I tested with png. I also used the SCALE_IMAGE function with uploaded images and I think this function when scaling the image also converts it to jpg file format (support can possible confirm?) and if so, this explains the errors i´ve had (at least with png files). I will onctinue testing but still, please share feedback if you know a bit more about the FILE_EXTENSION function. Thanks
Henrik (V8 Developer Ed. - Windows)
kklosson
Posts: 1628
Joined: Sun Nov 23, 2008 3:19 pm
Location: Virginia

Post by kklosson »

I use this, and I don't know if it is necessary to set the case, but I do...

If TO_UPPER_CASE(FILE_EXTENSION(Doc.FileName))<>'PDF' Then
REPORT ERROR 'Attachment must be a PDF document.'
hpl123
Posts: 2600
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

THX

Post by hpl123 »

Thanks Kklosson, then it works to use it like I have at least. I will continue testing and again I think maybe the problem was me using the SCALE_IMAGE together with the FILE_EXTENSION.
Henrik (V8 Developer Ed. - Windows)
Post Reply