This is probably an easy question but I have been looking at this code for a
while and it is all blurry..:)

I have an uploaded image in a temp file that I want to rename and put in
another folder.  I am using rename() which works fine, the problem is, I
want to force an overwrite if the file already exists.  For example, I am
allowing customers to upload an image for a certain product (row) in the db,
I get the row id and rename the image to a guid while they preview, then
move it into the permanent folder and rename it to image_$rowid.  They only
get one picture per row so if they want to change the picture, I want to do
the same process and just overwrite the old picture with the new one when
doing the rename.

Problem is, the rename throws errors if the image name already exists.  So I
have added unlink() do delete the image....but then I have to add code to
only delete if the image already exists...I am just looking for an easy way
to rename,move, and overwrite all in one step.

If anyone cares, I am working with oscommerce and trying to prevent
different users from uploading a picture with the same name, that is why I
am trying to rename the image to image_$rowid.

Thanks,
Eddie

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to