Reply to Re: Can't Delete File Using Unlink

Your name:

Reply:


Posted by Ahmed Abdel-Aliem on 04/11/05 21:45

On Apr 11, 2005 8:39 PM, Ben Ramsey <lists@benramsey.com> wrote:
> Ahmed Abdel-Aliem wrote:
> > On Apr 11, 2005 8:28 PM, Ben Ramsey <lists@benramsey.com> wrote:
> >
> >>Ahmed Abdel-Aliem wrote:
> >>
> >>>i have a problem with deleting files, i use windows XP and installed
> >>>on it apache server & PHP 5.1
> >>>i use unlink($file) to delete files but it doesn't work while it works
> >>>fine on my webhosting which is on linux machine
> >>>is there another function to use to delete files under windows instead
> >>>of link ??
> >>
> >>The webserver needs to have permission to modify the file that you are
> >>trying to delete. Check the file and directory permissions by
> >>right-clicking the directory and going to properties. You will probably
> >>need to give the user that controls apache either "full" or "modify"
> >>permissions to the Web directory.
> >>
> >>In general, permission settings under Windows suck.
> >>
> >
> >
> >
> > i tried that, when a file is being uploaded it becomes read-only, so
> > it can't be deleted, how can i make it not read-only by default ?
>
> Can you post the code you're using to upload and save the file to the
> Web server?
>

this is the function i am using to upload the file

function UploadFile($File) {

$this->File = $File;

$this->File_Name = strtolower($this->File['name']);

$SQL_Query = mysql_query("SELECT * FROM files WHERE file_name =
'$this->File_Name'");
$Records = mysql_num_rows($SQL_Query);



$arr = split("\.",$this->File['name']);

if($Records > 0){


$dst_file_name = $this->GenerateUniqueID();

$this->File['name'] =
$this->File['name'].$dst_file_name[1].$dst_file_name[5];
$this->File['name'] .= ".".$arr[count($arr)-1];

}
$this->File_Ext = $arr[count($arr)-1];

$dest_dir = 'files';
$dest = $dest_dir . '/' .$this->File['name'];
$r = move_uploaded_file($this->File['tmp_name'], $dest);
$this->File_Name = $this->File['name'];
chmod("files/".$this->File_Name, 777);

}


the partition the server on is Fat32

hop i will find a way to solve this, thanks
--
Ahmed Abdel-Aliem
Web Developer
www.ApexScript.com
0101108551
registered Linux user number 382789

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация