Page 1 of 1
problem with rename function
Posted: Thu Jul 22, 2004 4:00 pm
by pelegk2
i am tying to rename a file name :
Code: Select all
Warning: rename(./PDF/1.pdf,./PDF/book1.pdf): Permission denied in web/int/updateFiles.php on line 59
that is on a lnux server an i cant succeed
why is this?what can i do?
thnaks in advance
peleg
Posted: Thu Jul 22, 2004 4:02 pm
by feyd
does the script have write permission for that folder? Does it own the file?
iade some changes but
Posted: Thu Jul 22, 2004 4:17 pm
by pelegk2
now when i rename in th e same folder as the script everything is ok !
but when i do
Code: Select all
<?php
here everything is ok
rename("1.pdf","p1.pdf)
but :
here
Warning: rename("/PDF/2/1.pdf","/PDF/p1.pdf"): Permission denied web/int/uf1.php on line 3
and here :
Warning: rename("./PDF/2/1.pdf","./PDF/p1.pdf"): Permission denied web/int/uf1.php on line 3
?>
what can i do?
Posted: Thu Jul 22, 2004 4:29 pm
by feyd
you need write permission for all the directories you wish to manipulate.. you probably need to own them as well.
Posted: Thu Jul 22, 2004 4:47 pm
by pelegk2
but its a new folder i have made using ftp and its in my directory on the Host's server
Posted: Thu Jul 22, 2004 4:48 pm
by feyd
that doesn't mean apache uses the same user as your ftp connection..
Posted: Thu Jul 22, 2004 5:02 pm
by pelegk2
iss it possible that i have he same problem when i am trying to d/l a file :
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="123.pdf"');
readfile('./PDF/1pdf');
Posted: Thu Jul 22, 2004 5:06 pm
by feyd
generally, the apache user will be able to read the file, if it exists... depending on the defaults for permissions of uploading through ftp...
Posted: Thu Jul 22, 2004 5:08 pm
by pelegk2
its to download the file
and the file that is d/l is corrupted

Posted: Thu Jul 22, 2004 5:14 pm
by feyd
it may be corrupted by having extra characters enter the stream.. do a binary comparison between the two files, one before download and one after..
Posted: Thu Jul 22, 2004 5:17 pm
by pelegk2
how do i do that execly?
Posted: Thu Jul 22, 2004 5:22 pm
by feyd
I generally use a text editor, like
TextPad which has a file comparison function, or just load the files in binary mode. Generally the difference is a space or carriage return at the front or end of file accidently..