how to replace the file from server folder

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
mang
Forum Newbie
Posts: 8
Joined: Thu Nov 02, 2006 12:43 am

how to replace the file from server folder

Post by mang »

In my project i m going to upload a resume in specified folder on server and the file name is going to be saved in database
A user can later update his information and can upload the another file.So i want to repalce the previous file with this new file from server folder and So how can i do that ! I m using A php code

Thanking you in advance !
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I'm not sure why this is a security thread, but okay.

You're saving the filename in the database of the original. I'll presume that this filename is associated with the user, therefore you have the ability to find if they've uploaded a file before and what the filename is. You already know the location so it's a matter of maybe needing unlink(), but I don't remember absolutely needing it in many cases before calling move_uploaded_file().
Post Reply