The following code is working fine for uploading images. The node is being created but the uploaded images (under /sites/default/files/simpletest) are getting deleted after each complete test suite run.

Here the sample code

public function testArticleCreate() {
  $edit = array();
  $edit['title'] = $this->randomName(8);
  $edit["field_description[und][0][value]"] = $this->randomName(16);
  $field_name = 'field_image';
  $edit['files[' . $field_name . '_' . LANGUAGE_NONE . '_0]'] = 'sites/default/files/test-image.png'; // existed
  $this->drupalPost('node/add/article', $edit, t('Save'));


enter image description here

Getting 404 not found for the image path (sites/default/files/simpletest/505284/test-image.png)

Any suggestions?

1 Answer 1


I came to know that it's by design but not a bug. We can do nothing with the uploaded images. The SimpleTest files will be deleted automatically after successful test suite run.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.