Page 1 of 1

File Upload widget PUIUPLEXIT

Posted: Fri May 16, 2014 3:42 pm
by Wayne C.
We are considering using the File Upload widget in Genie to upload a file from one of our vendors. Does the program PUIUPLEXIT have to be modified or is it usable and safe in its original state? Any other things to be considered regarding this?

Thanks in advance.
Wayne C.

Re: File Upload widget PUIUPLEXIT

Posted: Mon May 19, 2014 11:39 am
by David
The PUIUPLEXIT program object is not shipped with Profound UI. We ship a 'skeleton' source member. It will not allow any uploads to occur if you use the 'skeleton' source without any changes. It's up to you to actually implement the logic and create the program.

This program controls security for the file upload. The idea is that Profound UI provides this program with some information about the transaction. For example, the user who is trying to upload a file, where they are trying to upload it to, the size of the file, etc. And then the program decides whether or not to allow the upload to happen.

It's very important to read over the documentation thoroughly and code the program so that only valid uploads are allowed. Let me know if there are any questions on it, I'd be glad to help.

Re: File Upload widget PUIUPLEXIT

Posted: Wed May 28, 2014 7:04 pm
by Wayne C.
Is there anyway that you or another Profound/Genie user could provide us with an example of a functioning program? We read the documentation and there are things that we're fuzzy on, but it would go along way in clearing some things up if we could see a functioning program.

Re: File Upload widget PUIUPLEXIT

Posted: Wed May 28, 2014 8:07 pm
by Scott Klement
Wayne, here's a very simple example that only allows access to one particular IFS directory.
If there are things you are unclear on, please ask.

Code: Select all

     H DFTACTGRP(*NO) ACTGRP(*CALLER)

     D* DS template for FileInfo parameter.
     D fileinfo_t      DS                  Qualified Based(Template)
     D  WidgetId                    256A
     D  Directory                   256A
     D  Name                        256A
     D  Type                        256A
     D  Size                         10U 0
     D  Exists                         N

     D* Do not change the prototype.
     D Main            PR                  ExtPgm('PUIUPLEXIT')
     D  FileInfo                           Const LikeDS(fileinfo_t)
     D  Allow                         5I 0
     D  ErrorMsg                    256A

     D* Do not change the procedure interface.
     D Main            PI
     D  FileInfo                           Const LikeDS(fileinfo_t)
     D  Allow                         5I 0
     D  ErrorMsg                    256A

      /FREE
        Allow = 0;


        // Allow uploads into "assetimg" directory:

        If FileInfo.directory = '/www/profoundui/htdocs/profoundui' +
                                '/userdata/images/assetimg';
           Allow = 1;
        EndIf;

        *InLr = *On;

      /END-FREE