unlink problems

unlink problems

am 25.11.2009 11:22:22 von Neil Jackson

--------------020209080402010305090305
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,
I use the following to delete a file on a webserver

if( unlink( "./$filename" ) )
{
echo $filename." deleted ";
$action='';
echo
"";
}

But I get the following error
Warning: unlink(./6 November 2009.pdf): No such file or directory in
/srv/www/htdocs/bee_partners/admin/tenders.php on line 82 6 November
2009.pdf not deleted

Any help?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iEYEARECAAYFAksNBV4ACgkQGgk1S8edB3JqWgCfb61pxGvh+KCXNfNdWgF2 kb/P
xCMAn2dSOgN9AiFYX35Ga00XyxZQwGnw
=NL6k
-----END PGP SIGNATURE-----


--------------020209080402010305090305
Content-Type: text/plain; charset=us-ascii

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

Re: unlink problems

am 25.11.2009 13:02:07 von Kesavan Rengarajan

Looks like the PDF is not in the admin directory. Try to use the full
path to the PDF file and also check the permissions on the file.

Sent from my iPhone

On 25/11/2009, at 9:22 PM, Neil Jackson wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
> I use the following to delete a file on a webserver
>
> if( unlink( "./$filename" ) )
> {
> echo $filename." deleted ";
> $action='';
> echo
> "";
> }
>
> But I get the following error
> Warning: unlink(./6 November 2009.pdf): No such file or directory in
> /srv/www/htdocs/bee_partners/admin/tenders.php on line 82 6 November
> 2009.pdf not deleted
>
> Any help?
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.9 (GNU/Linux)
> Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org
>
> iEYEARECAAYFAksNBV4ACgkQGgk1S8edB3JqWgCfb61pxGvh+KCXNfNdWgF2 kb/P
> xCMAn2dSOgN9AiFYX35Ga00XyxZQwGnw
> =NL6k
> -----END PGP SIGNATURE-----
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

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

Re: unlink problems

am 26.11.2009 04:24:54 von bedul

kesavan is right !!
i see the problem in link..

u type "./blabla.pdf" the main problem is in the "./"
remove the "./"
unless the file you want to remove are in the root



On 11/25/09, Kesavan Rengarajan wrote:
> Looks like the PDF is not in the admin directory. Try to use the full
> path to the PDF file and also check the permissions on the file.
>
> Sent from my iPhone
>
> On 25/11/2009, at 9:22 PM, Neil Jackson wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Hi,
>> I use the following to delete a file on a webserver
>>
>> if( unlink( "./$filename" ) )
>> {
>> echo $filename." deleted ";
>> $action='';
>> echo
>> "";
>> }
>>
>> But I get the following error
>> Warning: unlink(./6 November 2009.pdf): No such file or directory in
>> /srv/www/htdocs/bee_partners/admin/tenders.php on line 82 6 November
>> 2009.pdf not deleted
>>
>> Any help?
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v2.0.9 (GNU/Linux)
>> Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org
>>
>> iEYEARECAAYFAksNBV4ACgkQGgk1S8edB3JqWgCfb61pxGvh+KCXNfNdWgF2 kb/P
>> xCMAn2dSOgN9AiFYX35Ga00XyxZQwGnw
>> =NL6k
>> -----END PGP SIGNATURE-----
>>
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
akan ada dimana mulut terkunci dan suara tak ada lagi..
saat itu gunakanlah HP untuk melakukan SMS!!
-> ini aliran bedul.. bukan aliran aneh.
tertawa sebelum tertawa didepan RSJ..

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

Re: unlink problems

am 26.11.2009 05:58:54 von dmagick

Gunawan Wibisono wrote:
> kesavan is right !!
> i see the problem in link..
>
> u type "./blabla.pdf" the main problem is in the "./"
> remove the "./"
> unless the file you want to remove are in the root

../ means the current directory.

take that out - you still reference the current directory.

$ touch abc
$ ls ./abc
../abc
$ ls abc
abc

they are the same file.

Using a full path is the best because you always know what it will be
referencing.

--
Postgresql & php tutorials
http://www.designmagick.com/


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

Re: unlink problems

am 26.11.2009 16:15:17 von Richard Quadling

2009/11/25 Neil Jackson :
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
> I use the following to delete a file on a webserver
>
>        if( unlink( "./$filename" ) )
>        {
>                echo $filename." d=
eleted ";
>                $action=3D'';
>                echo
> "";
>        }
>
> But I get the following error
> Warning: unlink(./6 November 2009.pdf): No such file or directory in
> /srv/www/htdocs/bee_partners/admin/tenders.php on line 82 6 November
> 2009.pdf not deleted
>
> Any help?
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.9 (GNU/Linux)
> Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org
>
> iEYEARECAAYFAksNBV4ACgkQGgk1S8edB3JqWgCfb61pxGvh+KCXNfNdWgF2 kb/P
> xCMAn2dSOgN9AiFYX35Ga00XyxZQwGnw
> =3DNL6k
> -----END PGP SIGNATURE-----
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

Not exactly sure what help you would need? The file doesn't exist, so
you can't delete it.

But a quick hack later ...

http://www.beepartners.com/tenders/

is where the files are and

http://www.beepartners.com/admin/tenders.php

is where the script it.

So, "./$filename" should probably be "../tenders/$filename" maybe.

Regards,

Richard.
--=20
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=3DZEND002498&r=3D213474=
731
ZOPA : http://uk.zopa.com/member/RQuadling

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