Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
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.
Comment | File | Size | Author |
---|---|---|---|
#7 | webform_file_directory_path.patch | 2.46 KB | quicksketch |
#6 | 930082-6-file-directory-path.patch | 1.84 KB | Stevel |
#5 | 930082-5-file-directory-path.patch | 1.03 KB | ksenzee |
#4 | 930082-getting-rid-of-file_directory_path.patch | 2.54 KB | Stevel |
Comments
Comment #1
quicksketchYep, D7 Webform has postponed development until D7 stabilizes.
Comment #2
duntuk CreditAttribution: duntuk commentedIt's in beta now, should be good to go ahead and fix. Thanks
Comment #3
quicksketchWe were in code freeze a year ago, beta doesn't mean anything other than the upgrade path now works.
Comment #4
Stevel CreditAttribution: Stevel commentedThis patch replaces file_directory_path with file_build_uri to get a path to the default files folder.
Comment #5
ksenzeeI 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/.
Comment #6
Stevel CreditAttribution: Stevel commentedThere 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.
Comment #7
quicksketchThanks 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.
Comment #8
ksenzeeSorry - 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.
Comment #10
adham121 CreditAttribution: adham121 commentedYou Can use this in drupal 7
$files_dir = file_stream_wrapper_get_instance_by_uri('public://')->getDirectoryPath();
instead of
file_directory_path();
Comment #11
peijun CreditAttribution: peijun commentedTo get full path, please use
file_stream_wrapper_get_instance_by_uri('public://')->realpath();
Comment #12
Milado CreditAttribution: Milado commentedThanks for this, it works perfectly !
Comment #13
angel.hThanks a lot man! I was looking for this for a while as I'm runnig single code base website.
Comment #14
spot_the_cat CreditAttribution: spot_the_cat commentedThis 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).
Comment #15
RaulMuroc CreditAttribution: RaulMuroc commentedanother solution is:
variable_get('file_public_path', conf_path() . '/files');