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.

Large File Upload

  1. 3dp
    Member

    I need my users to be able to upload large files (300-350M) as part of their form (usually only one file at a time). Is this something possible with gravity forms assuming I have control over the PHP file size limits?

    Posted 14 years ago on Monday September 13, 2010 | Permalink
  2. Gravity Forms can handle any file size as long as your PHP setup can handle it. PHP controls file upload size limits and script timeout.

    Posted 14 years ago on Tuesday September 14, 2010 | Permalink
  3. 3dp
    Member

    Thanks!

    Posted 14 years ago on Tuesday September 14, 2010 | Permalink
  4. Carl, glad to hear the form can handle it. What I worry about is the user not knowing if it is working or not when the file may be huge. Say 100mb. Is there a way to add a progress bar? Also, is there a way for force those large files into a designated directory of our choice?

    Truf

    Posted 13 years ago on Thursday December 23, 2010 | Permalink
  5. Currently there is no progress bar. We plan on introducing a progress indicator when we introduce multi-file uploads from a single field.

    Yes, there is a filter you can use to change the upload directory using PHP. You can set this change so it effects ALL forms, or implement it so it only effects SPECIFIC forms.

    The code looks like this, as with all customizations using hooks and filters it would go in your themes functions.php file:

    Change upload directory for all forms:

    add_filter("gform_upload_path", "change_upload_path", 20, 2);
            function change_upload_path($path_info, $form_id){
                $path_info["path"] = "/new/path/";
                $path_info["url"] = "http://new_url.com/images/";
                return $path_info;
            }

    Change upload directory for specific form, the "4" in the gform_upload_path_4 below is the form id and this is what you would change for the form you want to customize:

    add_filter("gform_upload_path_4", "change_upload_path");
            function change_upload_path($path_info){
                $path_info["path"] = "/new/path/";
                $path_info["url"] = "http://new_url.com/images/";
                return $path_info;
            }

    You have to get the path correct, I believe it's an absolute path from the root of the server but I can't remember 100% off the top of my head. You have to also set the URL to the upload location, because this is used to then link to the image in the admin, notifications, etc. It may differ from the path as it is absolute.

    Posted 13 years ago on Thursday December 23, 2010 | Permalink
  6. I'm pretty new to php. I see that two paths are specified in the example. What is each one for, and why are they different?

    $path_info["path"] = "/new/path/";
    $path_info["url"] = "http://new_url.com/images/";

    Posted 13 years ago on Thursday December 23, 2010 | Permalink
  7. The PATH is used to actually store the file, the full physical path on the server to the folder you want to store the file. This folder has to have the correct file permissions set on it to allow uploads to go there.

    The URL is the http:// URL to that folder. This is used to link to the file that is uploaded from the entry detail, notification emails, etc. so you can access the file via HTTP.

    If the file isn't accessible via HTTP the only way to access them would be to manually FTP into your site and access the folder that way. So we have a URL parameter to set the URL for that folder so the files can be linked to.

    You don't have to provide the link that is created from the URL to people if you don't want to.

    Posted 13 years ago on Thursday December 23, 2010 | Permalink
  8. Dumb question - which file should I open to modify the path?

    Posted 13 years ago on Wednesday September 21, 2011 | Permalink
  9. You wouldn't modify the path in Gravity Forms by editing a Gravity Forms file.

    You would modify the upload path by adding custom PHP to your themes functions.php that uses a filter to set the file upload path.

    The hook for this is documented here:

    http://www.gravityhelp.com/documentation/page/Gform_upload_path

    Posted 13 years ago on Wednesday September 21, 2011 | Permalink
  10. jcollier
    Member

    I do development on my local machine, and then commit changes via git.

    Is there a path variable I could use to reference a new /assets/ directory (at the site root) in relationship to the index.php file rather than a full server path?

    Posted 12 years ago on Wednesday September 19, 2012 | Permalink
  11. @jcollier, please start a new topic for your issue. This one is over two years old. Thanks.

    Posted 12 years ago on Wednesday September 19, 2012 | Permalink

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