Im new to drupal and right now I need to create a node program.
I can create a simple node. But if I included it in the image field, it always failed.
$file_path = drupal_realpath('tmp/test_image.jpg'); $file = (object) array( 'uid' => 1, 'uri' => $file_path, 'filemime' => file_get_mimetype($file_path), 'status' => 1, ); $copy = file_copy($file, 'public://sites/default/files/field/image/testing/', FILE_EXISTS_RENAME); $node->field_image[LANGUAGE_NONE][0] = (array) $copy;
It always returns me an error :(
The specified file could not be copied, because the destination directory is not properly configured. This may be caused by a problem with file or directory permissions. More information is available in the system log.
source share