File put contents fails if you try to put a file in a directory that doesn't exist.

Comments

nevergone’s picture

Status: Active » Needs work
StatusFileSize
new578 bytes

Needs work.

greggles’s picture

From the top of the patch:

if (file_check_directory($file_dir, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {

file_check_directory should handle this with FILE_CREATE_DIRECTORY as an argument, right? You shouldn't to explicitly mkdir.

nevergone’s picture

StatusFileSize
new726 bytes

@greggles This is wrong.

$file_dir = file_directory_path();

so $file_dir == sites/default/files'

He had a bad variable name.

greggles’s picture

This seems like it could be a good change. I don't use 6.x any more so I'd like to get this RTBC'd by someone else who can test it.

betz’s picture

Can you check the following issue first? This also checks for recursive folders, which doesn't work currently.
#2159705: Not checking files directory recursively before save

I start from a empty files folder, so the folders get created, and would make this patch obsolete...

samuel.mortenson’s picture

Issue summary: View changes

I think this issue can be closed as issue #2159705 includes a reviewed patch which addresses this problem in addition to creating directories recursively.

greggles’s picture

Status: Needs work » Closed (duplicate)

Okeydoke.