Attaching image files to nodes programmatically in Drupal 7

Here is an example code using which you can use with node_save $filepath = drupal_realpath(‘misc/druplicon.png’); // Create managed File object and associate with Image field. $file = (object) array( ‘uid’ => 1, ‘uri’ => $filepath, ‘filemime’ => file_get_mimetype($filepath), ‘status’ => 1, ); // We save the file to the root of the files directory. $file … Read more

How can I check Drupal log files?

To view entries in Drupal’s own internal log system (the watchdog database table), go to http://example.com/admin/reports/dblog. These can include Drupal-specific errors as well as general PHP or MySQL errors that have been thrown. Use the watchdog() function to add an entry to this log from your own custom module. When Drupal bootstraps it uses the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)