It probably isn't supported in windows. Unlink is (in C) in the unistd.h file. 
It provides a way to remove a file based on the unlink syscall (which i 
sincerly doubt is available from Win32). Looking at php.net/unlink... yep 
fourth comment: "unlink() function dosen't work with windows98, but it dose 
work on NT with apache server".

If memory serves, there is an $OS variable... if not, check phpinfo(). You can 
do something like...

if ( stristr($OS, "Win") )
        exec("echo 'y' | del $file");
else
        unlink("$file");



On Thursday 31 October 2002 09:46 am, Andres, Cyrille wrote:
> Hello everyone,
>
> I upload some files on my server. If the number of lines of a file exceeds
> 159, I want to erase the file.
>
> Actually the unlink() function doesn't work, I have this error : Warning:
> Unlink failed (Permission denied) in D:\Data\WebSSL\tm\RFP\upload2.php on
> line 78.
>
> My code is :
>
>       $num = 0;
>       $fp = fopen ("temp/$i","r");
>       while ($data = fgetcsv ($fp, 1000, ","))
>       $num++;
>
>       echo "number of lines : $num";
>
>       if ($num>150){
>               echo "you have too many hotels";
>               unlink("temp/$i");
>
>       }
>       fclose ($fp);
>
>
> Do you have a clue ??
>
> Cyrille.

-- 
I pledge allegiance to the flag, of the United States of America, and to the 
republic for which it stands, one nation indivisible, with liberty, and 
justice for all.

-Pledge of Allegiance


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to