How to prompt a overwriting file warning ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
orangeapple
Forum Commoner
Posts: 70
Joined: Tue Jan 06, 2004 1:24 pm
Location: Geneva / Switzerland

How to prompt a overwriting file warning ?

Post by orangeapple »

Hi friends,

I have written a php code to save a database backup file on a client's pc. If that file already exists on the client's pc, the file is automatically overwritten. How can i detect if such a file already exists to prevent its overwritting ?

Thanks for your help !
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

how are you downloading the file? Normally, you the OS handles that, since you can't force the download to really happen, just the prompt to download to happen.
User avatar
orangeapple
Forum Commoner
Posts: 70
Joined: Tue Jan 06, 2004 1:24 pm
Location: Geneva / Switzerland

Post by orangeapple »

with :

fwrite and fclose

i have tried also with :

SELECT * INTO OUTFILE

in both cases, the OS doesn't prompt a warning.
Tks for your help
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

neither of those downloads to a client, they are used to write to the local file system. Displaying a prompt for those would involve checking if the file existed before creating them.
User avatar
orangeapple
Forum Commoner
Posts: 70
Joined: Tue Jan 06, 2004 1:24 pm
Location: Geneva / Switzerland

Post by orangeapple »

so how can i check if the file already exists ?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

User avatar
orangeapple
Forum Commoner
Posts: 70
Joined: Tue Jan 06, 2004 1:24 pm
Location: Geneva / Switzerland

Post by orangeapple »

Thanks ! :wink:
Post Reply