use copy() for a folder upper then the sending file

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
eyal
Forum Newbie
Posts: 19
Joined: Mon Jun 19, 2006 11:03 am

use copy() for a folder upper then the sending file

Post by eyal »

Hello,
How do you I upload a file for a folder which is in upper then the folder contains the .PHP file that asks that?

for example, I have a PHP file says

Code: Select all

copy($file,"folder1/photos");
But the PHP file is in the "photos" folder, not upper then that.

Thank you
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Sorry, I'm having difficulty understanding what you're trying to say. What do you mean by "upper" ?
eyal
Forum Newbie
Posts: 19
Joined: Mon Jun 19, 2006 11:03 am

Post by eyal »

In a case like this:

folder1/folder2/file.php

folder1 is upper then folder2 - It comes before folder1.
So when I write on file.php, which is in folder2, i can't copy a file using the copy() function into folder1.
how can I solve that problem?

Thank you.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

../sibling of folder 2/

Uploading of files needs to use move_uploaded_file(), not copy(), just so you know.
eyal
Forum Newbie
Posts: 19
Joined: Mon Jun 19, 2006 11:03 am

Post by eyal »

feyd wrote:../sibling of folder 2/

Uploading of files needs to use move_uploaded_file(), not copy(), just so you know.
Why move_uploaded_file is preferred then copy()?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Because move_uploaded_file() works when safe_mode is on.
Post Reply