I'm in the process of replacing my product images with new photos with the same filename. When I delete the old image in magento then reupload the new image, it adds _1 to the end of the filename, which makes me think it hasnt really deleted the old image. How can I fully delete the old image via magento so when I re-upload it keeps the correct filename?

1 Answer 1


I haven't tested this myself but you could try looking at:

In particular the line $uploader->setAllowRenameFiles(true);
The PHPDoc says:

If this variable is set to TRUE, uploaded file name will be changed if some file with the same name already exists in the destination directory (if enabled).

Try setting it to false and see if images are still appended with a number.

If that doesn't work, take a look at Mage_Catalog_Model_Resource_Product_Attribute_Backend_Image::afterSave() and try the same as above.

It would be great if you could post your results so other people can know which method works.

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.