Page 1 of 1

moving files

Posted: Wed Jun 04, 2003 2:42 pm
by redhair
I have been given upload rights from my host, but the directory i have writing permissions to is one higher then the actual webspace.

I already am able to write files to it. using this script:

Code: Select all

<?php
// copy to this directory
$dir="/usr/local/apache/www/myacount/phpupl/";

 // copy the file to the server
if (isset($submit)){
       
if (!is_uploaded_file ($userfile)){

   echo "<b>$userfile_name</b> couldn't be copied !!";
}
// check whether it has been uploaded
if (is_uploaded_file ($userfile)){
  move_uploaded_file($userfile,$dir.$userfile_name) ;
  }
   echo "<b>$userfile_name</b> copied succesfully !!";
}
//note:extra security will added later, this is just an example.
?>
Now...how do i get the files from "/usr/local/apache/www/myacount/phpupl/" to "/usr/local/apache/www/myacount/html/upload" with php script.
(Since there is no move() command in php.)

Posted: Wed Jun 04, 2003 2:58 pm
by volka
what's wrong with move_uploaded_file()?

Posted: Wed Jun 04, 2003 3:03 pm
by redhair
i have only file writing permissions in the /phpupl/ folder..
There is nothing wrong with move_uploaded_file() it writes beautifully to that dir...but i dont want it there..

Posted: Wed Jun 04, 2003 3:04 pm
by volka
if you have no write permissions for another directory you can't write/copy/move files there, sorry...

Posted: Wed Jun 04, 2003 3:07 pm
by redhair
ok, thank you.

directory permissions

Posted: Fri Jun 06, 2003 2:39 pm
by CAN007
I found that I have to change the permission of creating a folder:

@mkdir($root.'/webftpupload/'.$create,0777);

However, Im not sure if this is completely accurate... but it works.

Posted: Fri Jun 06, 2003 2:49 pm
by redhair
I dropped the idear to move the files.
Now i'm trying to (unsuccesfull so far..) show the images that are in the folder outside www.
see post:
viewtopic.php?t=9429

eventualy things will work...