uploading same files in different directories

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
Jeremy108
Forum Newbie
Posts: 5
Joined: Tue Jul 15, 2003 5:12 pm

uploading same files in different directories

Post by Jeremy108 »

I would like to upload a file and have it simeltaneously copied to a seperate directory. Possible?

Thanks,

Jeremy
User avatar
daven
Forum Contributor
Posts: 332
Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:

Post by daven »

I do not think it is possible to do a simultaneous copy, but you can always do a copy('current_location','other_location') after the file is uploaded
Jeremy108
Forum Newbie
Posts: 5
Joined: Tue Jul 15, 2003 5:12 pm

Post by Jeremy108 »

I tried the following script on an NT server:

<?php
if(!copy("test.txt", "/testdir/")) die ("Can't copy the file copyme.txt to copied.txt!");
?>

and this is the error message I get:

Warning: copy(/testdir/) [function.copy]: failed to create stream: Permission denied in D:\Inetpub\SecurityWeb\board\copy.php on line 2
Can't copy the file copyme.txt to copied.txt!

Any ideas?


Thanks,

Jeremy
Jeremy108
Forum Newbie
Posts: 5
Joined: Tue Jul 15, 2003 5:12 pm

Post by Jeremy108 »

oh yeah, I forgot to mention, I made sure the permssions on the file and the folder is set to read, write, execute and delete and still same error message.
User avatar
daven
Forum Contributor
Posts: 332
Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:

Post by daven »

You need to supply the full path for the copy destination (ex: c:\myDir\copied.txt)
Post Reply