Jump to content

Unlink function not working with permission 600


Gruzin

Recommended Posts

Hi everyone,

 

I have a folder with permission 777 and I can upload files, but I can not delete this files using unlink function... Also I can not change file permission from 600 to 777 or 755.

 

Here is my error:

Warning: unlink(../../uploads/) [function.unlink]: Permission denied in /www/cid.ge/doc/admin/functions/eng/delete_image.php on line 11 

 

Thanks for any help,

George

Link to comment
Share on other sites

I've tryed to change it using my ftp client (FlashFXP), doesn't work...

 

You'll need to cnange it via php. Your files will be owned by the same process as apache (usually apache), therefore logging in and trying to change permissions via an ftp client will not work.

Link to comment
Share on other sites

Thanks guys,

 

here is my delete script, I'am trying to change chmod there... is that correct or do I have to change it when I upload the file?

 

<?php
require ('../../config.php');
$id = $_GET['del_id'];
$sql = mysql_query("SELECT * FROM aid_image WHERE id='$id'");
while($row = mysql_fetch_array($sql)){
$image = $row['image'];
}
$query = "DELETE FROM aid_image WHERE id='$id'";
$result = mysql_query($query) or die("Error: " . mysql_error());
$file = chmod("../../uploads/".$image, 0777); // remove file from directory
unlink($file);
header ('Location: eng_dir_image_management.php');
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.