PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

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 13 years 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 13 years ago on Wednesday November 2, 2011 | Permalink
  3. simbian
    Member

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

    Posted 13 years ago on Wednesday November 2, 2011 | Permalink
  4. i made a post to help with this:
    http://www.gravityhelp.com/forums/topic/file-upload-location-and-name#post-76119

    Posted 12 years ago on Tuesday September 18, 2012 | Permalink
  5. Thank you @bristweb.

    Posted 12 years ago on Tuesday September 18, 2012 | Permalink

This topic has been resolved and has been closed to new replies.