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.

separating files and images

  1. sascha
    Member

    Hi there,
    is it possible to save uploaded files and post images into separate folders? I use the gform_upload_path filter already, but would like to save images into: ../post_images
    and files into: ../files_uploads

    So if I have a form asking for 3 post images and 1 file upload, the images go to ../post_images and the file goes to ../file_uploads. This could be a global setting or a setting from form to form.
    Any ideas?

    Posted 12 years ago on Monday December 5, 2011 | Permalink
  2. There is no setting like that. You could do it with some code to move the files after uploading, similar to renaming them after upload. Move and rename are actually the same function, essentially, so the code would be the same. Some related reading for your customization:

    Most recent and relevant:
    http://www.gravityhelp.com/forums/topic/append-a-prefix-to-file-uploads#post-39657

    Also related, with more code:
    http://www.gravityhelp.com/forums/topic/renaming-uploaded-files-before-saving
    http://www.gravityhelp.com/forums/topic/custom-uploads#post-19064
    http://www.gravityhelp.com/forums/topic/renaming-file-uploads#post-2324

    Posted 12 years ago on Monday December 5, 2011 | Permalink
  3. sascha
    Member

    Hi Chris,
    thanks for the references! If I now find out how to move a file with php, then that task should be easy peasy!

    Posted 12 years ago on Monday December 5, 2011 | Permalink
  4. http://php.net/manual/en/function.rename.php

    [php]
    <?php
    rename("/old/tmp/tmp_file.txt", "/home/user/login/documents/my_file.txt");
    ?>
    Posted 12 years ago on Tuesday December 6, 2011 | Permalink
  5. sascha
    Member

    Hey Chris,
    thanks soooo much. That saves me hours of trying to find the right bit of PHP!

    Posted 12 years ago on Tuesday December 6, 2011 | Permalink

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