hi every body,
i was trying to upload an image using drupal form api,
i used some examples i found drupal,
and i get this error :
Warning: filesize(): stat failed for temporary://220720091939.jpg in file_save() (line 570 of ...
is there any solutions?!?!

Comments

Jaypan’s picture

You should confirm that the temporary folder path has been set in your file settings configuration. I'm not sure that this will solve your problem, but it's a start.

haj1st’s picture

temp folder is set,
i get 2 kinds of errors one of them depends on data base,
any ideas what i should do about this one?!
the second error i get is:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'temporary://997653_20100614_screen007.jpg' for key 'uri': INSERT INTO {file_managed} (uid, filename, uri, filemime, filesize, status, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => 997653_20100614_screen007.jpg [:db_insert_placeholder_2] => temporary://997653_20100614_screen007.jpg [:db_insert_placeholder_3] => image/jpeg [:db_insert_placeholder_4] => 418157 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 1349935385 ) in drupal_write_record() (line 7036 of /var/www/drupal2/includes/common.inc).

Jaypan’s picture

The system is saying that it cannot create a temporary file with that name in the database, as that filename already exists in the database. Usually filenames are generated randomly on each run, so I'm suspecting that maybe whatever script you are using is trying to save the file twice, and you are getting the error on the second time.

That's fully speculation however. It could be a number of other things as well.

haj1st’s picture

it seems its because the file already exists but i also set FILE_EXISTS_RENAME option for file_save()