electrix Posted June 28, 2007 Share Posted June 28, 2007 Before anyone says anything, YES I have searched on this forum and google without luck! <?php echo $_GET[filename1]." - GET<BR>"; $file = "/$_GET[filename1]"; $file2 = "/ny/$file"; rename('$file','$file2'); } ?> I want to move the file that is in "root" (aka "/") to the folder "ny". All the file/folder permissions is 777. The file still won't move or even copy to the folder or any other folder....? Anybody? Or maybe you know a better way to move a filer to a folder? Thanx in advance.. Quote Link to comment Share on other sites More sharing options...
no_one Posted June 28, 2007 Share Posted June 28, 2007 copy() should copy a file/folder... unlink() would delete it. Rename() doesn't move it at all as far as I know. http://us2.php.net/copy Quote Link to comment Share on other sites More sharing options...
electrix Posted June 28, 2007 Author Share Posted June 28, 2007 So what is wrong with this then? <?php $file = $_GET[filename1]; if (!copy($file, /ny/$file)) { echo "failed to copy $file...\n"; } unlink($file); ?> Can it be something with the " /ny/$file " ? Quote Link to comment Share on other sites More sharing options...
no_one Posted June 28, 2007 Share Posted June 28, 2007 In the code provided, the /ny/$file isn't quoted. if( !copy($file, "/ny/" . $file) ) { } Quote Link to comment Share on other sites More sharing options...
electrix Posted June 28, 2007 Author Share Posted June 28, 2007 In the code provided, the /ny/$file isn't quoted. if( !copy($file, "/ny/" . $file) ) { } Nope it doesn't work.. I get the message "failed to copy" .... Quote Link to comment Share on other sites More sharing options...
no_one Posted June 28, 2007 Share Posted June 28, 2007 Might want to try file_exists() to see if it's even there before copying. More absolute paths? or maybe "./ny/" or "./" . $file might help. I don't know what $file is really, just giving ideas. Is it a filename? or name+path? Quote Link to comment Share on other sites More sharing options...
electrix Posted June 28, 2007 Author Share Posted June 28, 2007 Might want to try file_exists() to see if it's even there before copying. More absolute paths? or maybe "./ny/" or "./" . $file might help. I don't know what $file is really, just giving ideas. Is it a filename? or name+path? It's a filename.. And yes I've tried ./ and absolute paths.. Still not working.. Quote Link to comment Share on other sites More sharing options...
electrix Posted June 28, 2007 Author Share Posted June 28, 2007 Ahh! I've got an error-message now... Warning: copy() [function.copy]: SAFE MODE Restriction in effect. The script whose uid is 200453 is not allowed to access / owned by uid 0 in /customers/randomriot.net/randomriot.net/httpd.www/move.php on line 14 failed to copy tradera.txt... Can someone tell me if there is a way to override SAFE MODE or another way to copy/move a file ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.