Page 1 of 1

how to rename a file ?

Posted: Thu May 14, 2009 1:18 am
by ubsacc2004
hi all ,

below is my code but why i cant rename ? and it got error.

Code: Select all

 
 
<?php
    rename("Z:\\Moodle19\\server\\moodle\\Marking\\Suggested Answer DBF\\BACKUP-set2-4.ACC", "Z:\\Moodle19\\server\\moodle\\Marking\\Suggested Answer DBF\\BACKUP-set2-4.ZIP");
?> 
 
 
 
 
Thanks.

Re: how to rename a file ?

Posted: Thu May 14, 2009 3:04 am
by Griven
Are you sure you need to use double slashes? I've never used that function, and I don't have access to my server to test it right now...

If using single slashes doesn't work, consider the following:

It's important to note that, in general, your web application will not run with the same permissions as your own user account. Just because you can log onto the server and rename a file, does not mean that your web-service account can do the same.

Check the permissions on the file or folder that the file is contained in, and assign the correct permissions to the account.

You may want to check in with the security board and ask them about the implications of such an action before putting this into production, however.

Re: how to rename a file ?

Posted: Thu May 14, 2009 3:16 am
by Hightower
Any chance you could post the error you get? Would go a long way towards helping you. :)

Re: how to rename a file ?

Posted: Thu May 14, 2009 3:28 am
by ubsacc2004
Griven wrote:Are you sure you need to use double slashes? I've never used that function, and I don't have access to my server to test it right now...

If using single slashes doesn't work, consider the following:

It's important to note that, in general, your web application will not run with the same permissions as your own user account. Just because you can log onto the server and rename a file, does not mean that your web-service account can do the same.

Check the permissions on the file or folder that the file is contained in, and assign the correct permissions to the account.

You may want to check in with the security board and ask them about the implications of such an action before putting this into production, however.
hi,


i sure i got permissions for the filepath due to i the administrator for this web server. I new in PHP. i just copy the code from website. So i dont know single slashes will solve or not. Will try it out.

Thanks.