Page 1 of 1

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

Posted: Sat Nov 11, 2006 7:17 am
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

Posted: Sat Nov 11, 2006 7:34 am
by Chris Corbyn
Sorry, I'm having difficulty understanding what you're trying to say. What do you mean by "upper" ?

Posted: Sat Nov 11, 2006 7:42 am
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.

Posted: Sat Nov 11, 2006 8:14 am
by feyd
../sibling of folder 2/

Uploading of files needs to use move_uploaded_file(), not copy(), just so you know.

Posted: Sat Nov 11, 2006 8:34 am
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()?

Posted: Sat Nov 11, 2006 9:06 am
by feyd
Because move_uploaded_file() works when safe_mode is on.