GFFormsModel::get_file_upload_path() return the path and "1" BUG?

Hey there,

I use GFFormsModel::get_file_upload_path() to have the upload path of my form. (I need that to encode the file in base64 and send it as json).

The function run like this :
GFFormsModel::get_file_upload_path(2, $entry[‘27’]);

2 is my form ID, entry[27] is my upload field ID.

It return me the correct path put with a “1” at the end of the name before the extension of the file.

Small example for you to understand :

My filename uploaded : cat.jpg

it return me this path :

It add “1” to the name, I dont understand why. And so, the path isnt correct, cause the file is stored as “cat.jpg”, in the folder and in the database.

I deleted all the saved entry of the form, cause the same file name could add a number 1 to prevent having the same file at the same place, but it change nothing. (if the name would be cat1.jpg, the function would return cat11.jpg…)

Hope someone can help me with this, and hope my post is easily understandable :slight_smile:

Can you share the full snippet that you’re using including the add_filter or add_action line?

Hey there, I tried inside a hook, or just c/c from the documentation, same result…

Only code that fix this was found here : Gravity Forms gform_after_submission File Names and URLs

The str_replace fix this, I dont have the “1” anymore at the end of the filename and so I the path to the file is correct.

But test from your side, on a fresh install, if the get_file_upload_path() return the correct path or not…

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.