I'm back with another uploader question. How can I overwrite the image that is already in the users directory? The user can have either gif or jpg image, but are only allowed one image. So if they first uploaded a jpg, then a gif later on, it shows both the images. How can I get the different file formats to overwrite eachother?
If the code is in the uploader, here's the upoloader script
The best way would be to delete the old image (if it exists). At least thats the only way I can think of but I don't know much about directory and file functions.
__________________ I don't suffer from insanity, I enjoy every single minute of it!
I don't know anything about them either. I've been thinking that it may be best to rename the image to the extension that's in the direcetory, but I have no idea how to do that either. The uploader has thrown me off coz I have no idea how it works.
It's renamed to their username and then put into the users directory. I think that's how it happens, FirePages was the one that gave me the uploader but I can't figure it out myself.
I came across a problem earlier though I can't overwrite anything in the directory, nor delete, nor rename. Once the file's there, it's there forever, or until my host deletes it
MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
Last edited by firepages; 07-10-2002 at 06:32 AM..
MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
If you upload a .gif with PHP and then name it ***.jpg it becomes
a jpeg - transparent colours become white. That's with using
move_uploaded_file($imagefile,"path/newname.jpg");
__________________ Ökii - formerly pootergeist teckis - take your time and it'll save you time.