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.

Resolving FAILED (Upload folder could not be created.)

  1. The form submission works, but both email and entry via the admin show this lovely
    "FAILED (Upload folder could not be created.)" message. On the documentation the file upload provides little / no detail regarding where files go, how they are stored (permissions), etc. I do see that /wp-content/uploads/gravity_forms has been created but no files within there yet. Any links to documentation on troubleshooting what I figure is a basic initial setup question would be helpful.

    Diagnostic Info:
    PHP Version 5.1.6
    MySQL Version 5.0.45
    WordPress Version 2.9
    Gravity Forms Version 1.3.8

    Posted 10 years ago on Wednesday December 30, 2009 | Permalink
  2. Double check the file permissions on wp-content/uploads/gravity_forms to be sure that it inherited writeable permissions and Gravity Forms can write to this folder. This is where it stores file uploads and you need to make sure it has writeable file permissions (755) on the folder.

    It creates subfolders within uploads/gravity_forms and doesn't store anything in the root of that folder and that error means it was unable to create a subfolder as the server would not allow it.

    Posted 10 years ago on Wednesday December 30, 2009 | Permalink
  3. It does create the folder - and it does have the required permission settings - but still receiving the same error message. It did make a subfolder '2' in one of my test runs, but no uploaded files. Also tested with '777' and same result.

    Other suggestions or info that I can provide which would help diagnose?

    It is running as a sub-domain on a Plesk-based VPS server where the db is part of the primary domain.

    Posted 10 years ago on Wednesday December 30, 2009 | Permalink
  4. Can you give us a WordPress login so we can check it out? Hit me up via our Contact Us form.

    Posted 10 years ago on Wednesday December 30, 2009 | Permalink
  5. ccappel
    Member

    Hey - Having the same problem ... it would be helpful if the solution were posted here as well, especially since the issue has been marked resolved. Carl, can you tell us what the problem was? Thanks!

    Posted 10 years ago on Wednesday February 10, 2010 | Permalink
  6. The first thing you need to do is double check file permissions. If the uploads aren't working it is because it is unable to write to your server. Gravity Forms creates a gravityforms folder in your wp-content/uploads folder. So you need to be sure it has the appropriate file permissions to be able to do this.

    Posted 10 years ago on Wednesday February 10, 2010 | Permalink
  7. The issue is not (yet) resolved. I have tried all folders with 777 permissions (/wp-content, /wp-content/uploads/, /wp-content/uploads/gravity_forms) and still no luck.

    Posted 10 years ago on Tuesday March 9, 2010 | Permalink
  8. While this isn't the most elegant solution, I have managed to make a work-around for my environment that solves this issue and a related one of not being able to create export .csv files. Basically I commented out any of the plugins attempts to create sub-folders to the /wp-content/uploads/gravity_forms folder and let it do all the file creation within that folder.

    To do so, I made the following changes in /wp-content/gravityforms/forms_model.php that start at around line 1075 in version 1.3.10.

    public static function get_upload_path($form_id){
    	  //return self::get_upload_root() . $form_id;
    	   return self::get_upload_root();
    }
    public static function get_upload_url($form_id){
            $dir = wp_upload_dir();
            //return $dir["baseurl"] . "/gravity_forms/$form_id";
    	   return $dir["baseurl"] . "/gravity_forms/";
    }

    The last one is a little longer function so more written instruction than copy/paste
    Find public static function get_file_upload_path($form_id, $file_name) {

    Comment / replace the $target_root and $target_rool_url lines below:

    //$target_root = self::get_upload_path($form_id) . "/$y/$m/";
    	   $target_root = self::get_upload_path($form_id);
            //$target_root_url = self::get_upload_url($form_id) . "/$y/$m/";
    	   $target_root_url = self::get_upload_url($form_id);

    Comment out the attempted directory creation directly below

    //if(!wp_mkdir_p($target_root))
                //return false;

    I still can't answer WHY my environment won't allow those folders to be created even though it appears everything has proper permissions to do so, which sucks from an ongoing upgrade perspective. But this does work for the time being.

    Does this help with a potential fix for it?

    Posted 10 years ago on Tuesday March 9, 2010 | Permalink
  9. You should also check whether your server is setup in php safe_mode or not. A related WP support forum thread on permissions has further identified this setting and the wp_mkdir_p function as having issues.

    This happened to also be the case on my server :(

    Posted 10 years ago on Tuesday March 9, 2010 | Permalink
  10. Have you determined if the PHP safe_mode is what is causing this issue? If it isn't allowing subfolders to be created, it could explain why Gravity Forms isn't able to do so.

    Posted 10 years ago on Tuesday March 9, 2010 | Permalink
  11. It appears to be the main culprit yes. Something you might want to add to the list of known troubleshooting questions that people should look at.

    Posted 10 years ago on Tuesday March 9, 2010 | Permalink
  12. Okay that helps some, we can see about finding a test host we can use that has PHP Safe Mode turned on so we can see what is going on.

    Hosts that have it turned on by default sometimes allow you to turn PHP Safe Mode off. Even the PHP organization doesn't recommend using PHP Safe Mode and it has been deprecated in PHP 5.3 and completely removed in PHP 6.

    Does your host allow you to turn it off?

    Posted 10 years ago on Tuesday March 9, 2010 | Permalink
  13. EXIST SOLUTION FOR THIS PROBLEM
    wp-admin/FAILED (Upload folder could not be created.)

    My blog is http://www.ramoservice.com/

    wp-content/ 777
    uploads / 777
    gravity_forms/ 777

    Posted 10 years ago on Wednesday March 31, 2010 | Permalink
  14. @pikasostar If the upload folder cannot be created despite the fact you have CHMOD 777 on the upload folder then you need to contact your web host and find out what server setting or configuration they may have setup that could cause a PHP application not to write a file or create a folder despite the fact you have set the correct permissions.

    The first thing to ask is if hosting configuration has PHP Safe Mode is ON.

    PHP Safe Mode turned ON is not recommended, even by the creators of PHP and it is being removed from future versions of PHP.

    If you have PHP Safe Mode turned ON this will prevent PHP applications from being able to create folders and write files properly.

    Posted 10 years ago on Wednesday March 31, 2010 | Permalink
  15. I Find the solutions for this problem (Upload folder could not be created.) First you change permissions to gravity_forms folder 777 or 755 . Second you need to go to plesk or control panel and disable (PHP 'safe_mode' on ) .

    THE STEP TO DISABLE (PHP 'safe_mode' on )

    1) Login to your Plesk control panel.

    2) Now go to Domains.

    3) Select the domain name you wish to change the PHP safe mode for. Then select Group options which is located on the upper part of the Domains page.

    4) Look for Hosting options below.

    5) Now search the line “PHP ’safe_mode’ on”.

    6) Under the Disable column, tick the radio button.

    Now the safe mode is Off and you will be able to run the applications which require PHP safe mode Off.

    http://www.ramoservice.com

    Posted 10 years ago on Wednesday March 31, 2010 | Permalink
  16. Is there anything other than turning PHP Safe Mode off that will fix this?

    I recreated the uploads/gravity_forms directory and set permissions at 777, but it doesn't work.

    I'll have to switch servers to be able to turn safe mode off, and I don't love the sound of what my host says about it:

    In a shared hosting environment such as we offer, keeping everyone's web site safe and secure is of vital importance. We have carefully constructed our PHP 5 Fast environment to make your site and its files as secure as possible while still running at maximum performance, and PHP's safe_mode is currently one of the many essential components of that environment.

    We do offer PHP 5 Flex, which is a way to run PHP without safe_mode restrictions in our CGI environment. If the need is great, PHP 5 Flex should be compatible with certain legacy applications (e.g. Gallery) that malfunction if safe_mode is enabled, but it generally runs at least 3-10 times slower than PHP 5 Fast.

    Most people who choose PHP 5 Flex do so for the wrong reasons. It can mask the existence of certain problems and thus sometimes appears to be an easy way to make broken things appear to work. Due to the severe performance penalty, we strongly recommend against using PHP 5 Flex to circumvent open_basedir() restrictions or PHP file permissions issues. Problems with open_basedir are almost always caused by incorrect path configurations or depending on bad default paths, issues which are typically very easy to resolve under PHP 5 Fast. File permissions issues merely require a basic understanding of the Unix owner/group file permissions system. If you use PHP 5 Flex to solve the problem instead, you will destroy the performance of your site for no reason. See Writing Files in PHP for more information.

    Posted 10 years ago on Tuesday May 25, 2010 | Permalink
  17. There is nothing that can be done with PHP Safe Mode Turned On to fix this. It literally prevents PHP from being able to do certain things when it comes to writing files and folders.

    Your host is wrong about PHP Safe Mode.

    PHP Safe Mode had actually been deprecated in PHP 5 and removed completely in PHP 6. The PHP organization highly discourages people from using it. You can read more about it here:

    http://php.net/manual/en/features.safe-mode.php

    PHP Safe Mode is a fallback web hosts use when they can't solve their own shared server security issues.

    Posted 10 years ago on Wednesday May 26, 2010 | Permalink
  18. Thanks for the link! I will contact my host and see what they plan to do about it. Won't be very happy if they don't upgrade PHP because of that.

    Posted 10 years ago on Thursday May 27, 2010 | Permalink

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