Fix for destination directory errors
AniKarenina - August 14, 2009 - 17:56
| Project: | File import |
| Version: | 6.x-1.0-beta3 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
Despite the configuration options being properly set, we were continually receiving the error message that a file could not be uploaded because the destination is not properly configured. We traced this to a bug in file_import.
The module uses the file_move function and passes it the old and new file name, but the file_move function actually takes the old name and the new directory. Hence the error about the destination directory not being set correctly--it's being given the file name. We edited file_import and were able to do the import.
I'm not set up to create a proper patch, but here's the diff for the change:
350c350,351
< $new_filename = variable_get('file_import_output_path', file_directory_path()) .'/'. $origname;
---
> $new_directory = variable_get('file_import_output_path', file_directory_path()) ;
> $new_filename = $new_directory.'/'. $origname;
363c364
< if (file_move($filename, $new_filename)) {
---
> if (file_move($filename, $new_directory)) {