Add a prefix to file uploads

  1. simbian
    Member

    Hello to all, as i wanna limit the access to the form to only registered users i also would like to know if it's possible to automatically set a prefix (hidden for the users) to file uploads so i can know which user has uploaded the files.

    I would generate the prefix dinamically using the Wordpress global variable $user_login http://codex.wordpress.org/Function_Reference/get_currentuserinfo

    So an example: the registered user Joe access the form and upload a file called sample.zip, in the upload folder of my web server so i should have the file named Joe_sample.zip

    thanks,
    Simone from Italy

    Posted 6 months ago on Tuesday November 1, 2011 | Permalink
  2. Hello Simone,
    We don't have a hook to easily allow you to change the file name as the file is uploaded. However, you can use the gform_after_submission hook to rename the file after it has been uploaded.
    Following is a documentation of that hook.
    http://www.gravityhelp.com/documentation/page/Gform_after_submission

    You will need to read the $entry variable to get the current file name. You will then have to rename the actual file as well as update the database record to match the new file name.

    Posted 6 months ago on Wednesday November 2, 2011 | Permalink
  3. simbian
    Member

    thanks for the tip Alex, i will look for to get it working...

    Posted 6 months ago on Wednesday November 2, 2011 | Permalink

Leave A Reply

You must log in to post.