Contributions

Images (Category Index)
Search: 

Randomimage filename

There is an annoying problem about file uploads in oscommerce:
When you upload a picture with mypic.jpg to a product, and later you upload an other picture (I mean to an other product) with the same filename mypic.jpg
the second picture will overwrite the first one, so the first product will have the second products' picture :(

My solution is a little function which will add a random string to each uploaded filename, this way it prevents any overwrite problem.

Installation steps and modified upload.php file for RC2.2a version are in the zip file attached.

Expand All / Collapse All

Randomimage filename 25 May 2009

There is an annoying problem about file uploads in oscommerce:
When you upload a picture with mypic.jpg to a product, and later you upload an other picture (I mean to an other product) with the same filename mypic.jpg
the second picture will overwrite the first one, so the first product will have the second products' picture :(

My solution is a little function which will add a random string to each uploaded filename, this way it prevents any overwrite problem.

Installation steps and modified upload.php file for RC2.2a version are in the zip file attached.

Note: Contributions are used at own risk.