• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
unlink error - don't know how to fix it

#1
[eluser]überfuzz[/eluser]
I get an errorwhen I try to unlink a pdf-file.
Quote:A PHP Error was encountered

Severity: Warning

Message: unlink() [function.unlink]: http does not allow unlinking

Filename: information/schema.php

Line Number: 109

How do I set the permission to 777 or something arbitrary when I upload it? I get 644 all the time. Hence I can't unlink.

#2
[eluser]CroNiX[/eluser]
http://php.net/manual/en/function.chmod.php

You should just change that directories permissions to 777, not the individual file.

#3
[eluser]überfuzz[/eluser]
I guess my post was somewhat vague. I'm trying to use the ftp class to alter the permissions. But nothing seems to happen with the files I'm aiming for...

Code:
$this->load->library('ftp');
$this->ftp->chmod($path, DIR_WRITE_MODE);

Edit, my the last post was not a reply to your post CroNiX. I didn't see it before I started scribble mine.

#4
[eluser]CroNiX[/eluser]
I havent used the ftp class, but in the documentation it has this example:
$this->ftp->upload('/local/path/to/myfile.html', '/public_html/myfile.html', 'ascii', 0775);

It looks like you can set the permissions using the 4th parameter.

#5
[eluser]BrianDHall[/eluser]
I could be wrong, but your error message doesn't indicate that you have a problem with permissions, it says http doesn't allow unlink, which is I believe the error when you do something like unlink('http://mysite.com/myfile') - which you can't do. You have to provide unlink() a link relative to your local filesystem or have one of the wrappers in PHP that allows some other functionality (but HTTP isn't ever an option with unlink), so make sure of that before you worry about chmod.

#6
[eluser]überfuzz[/eluser]
Thanx both of you! Your posts really helped me to sort things out.

The only, hopefully, error now is when I try to beef it up to take 5M size pdf files. My client wanted it!? When I check the server the file is there, but my script stops. When I checked the ini.php file it stated a 12M limit...


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.