In components/file.inc, line 275, is a call to file_directory_path() , which no longer exists in Drupal 7.
It makes Webform unusable to send attached files.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Status: Active » Postponed

Yep, D7 Webform has postponed development until D7 stabilizes.

duntuk’s picture

It's in beta now, should be good to go ahead and fix. Thanks

quicksketch’s picture

We were in code freeze a year ago, beta doesn't mean anything other than the upgrade path now works.

Stevel’s picture

Version: 7.x-3.0-beta8 » 7.x-3.x-dev
Status: Postponed » Needs review
FileSize
2.54 KB

This patch replaces file_directory_path with file_build_uri to get a path to the default files folder.

ksenzee’s picture

I filed #942974: WSOD on private file downloads as a separate issue, so I don't think webform_file_download() is worth patching here. The only other use of file_directory_path is for the field_prefix on the file component edit form. I changed that so that we're displaying the actual directory the files will go in - I think sites/mysite.com/files/webform/ will make more sense to people than public://webform/.

Stevel’s picture

There is one other mention of file_directory_path in the comment of _webform_recursive_delete, so this patch includes a changed comment in addition to ksenzee's patch in #5.

This is RTBC for the part in #5, so only review needed for the comment.

quicksketch’s picture

Status: Needs review » Fixed
FileSize
2.46 KB

Thanks ksenzee and Stevel for the patches. I've rerolled it to remove _webform_delete_recursive() entirely, since we can now use file_unmanaged_delete_recursive() provided by core instead. Committed to HEAD.

ksenzee’s picture

Sorry - I removed that mention in the comment precisely because I was going to suggest nixing _webform_delete_recursive, then I forgot to say why I did it. Luckily quicksketch is way ahead of me.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

adham121’s picture

You Can use this in drupal 7

$files_dir = file_stream_wrapper_get_instance_by_uri('public://')->getDirectoryPath();

instead of

file_directory_path();

peijun’s picture

To get full path, please use
file_stream_wrapper_get_instance_by_uri('public://')->realpath();

Milado’s picture

Thanks for this, it works perfectly !

angel.h’s picture

Thanks a lot man! I was looking for this for a while as I'm runnig single code base website.

spot_the_cat’s picture

This is a perfect example of what happens when the OOPs get hold of something. I mean, seriously; was file_directory_path() too easy?

I'm looking to move on once D8 is in circulation, (I have years of C++ so I'm completely familiar with OOP).

RaulMuroc’s picture

Issue summary: View changes

another solution is:

variable_get('file_public_path', conf_path() . '/files');