Skip to main content
Inspiring
September 5, 2006
Question

OT: PHP unlink()

  • September 5, 2006
  • 26 replies
  • 1411 views
As discussed on the PHP.Net site, I am throwing a permission denied error -

Warning: unlink(../images/users/Murray/Creek.jpg) [function.unlink]:
Permission denied in
W:\Webspace\resadmin\madison\madisonconcrete.com\www\manage\m_users_update.php
on line 82


when I try to delete an image file from a folder with this markup -

unlink('../images/users/'.$userName."/".$_POST['images']);

There are several vague workarounds there that I'm not sure I fully
followed. One of them says to make an ftp connection and then use ftp
delete to wipe the file. Is this the best way?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================



This topic has been closed for replies.

26 replies

Inspiring
September 5, 2006
On 05 Sep 2006 in macromedia.dreamweaver.appdev, Murray *ACE* wrote:

>> You could try the PHP-general mailing list. It's frequented by some
>> of the guys who write the core code for PHP.
>
> Where is that, David?

http://www.php.net/mailing-lists.php

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/email.php
Inspiring
September 5, 2006
> Obvious question: did you test the script in your local testing
> environment?

No. Only on the production server.

> Logically speaking, you should be able to delete items from the same
> folder that you created them in, but computer logic doesn't always follow
> the same rules as human logic.

Yes - that's what has me so tied up in knots....

> You could try the PHP-general mailing list. It's frequented by some of the
> guys who write the core code for PHP.

Where is that, David?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"David Powers" <david@example.com> wrote in message
news:edkfkb$gkq$1@forums.macromedia.com...
> Murray *ACE* wrote:
>> I don't want to thrash with this. Where do you suggest I go to try to
>> get an answer?
>
> You could try the PHP-general mailing list. It's frequented by some of the
> guys who write the core code for PHP.
>
>> I have just this one thing I need to do - Delete images that I have
>> uploaded.
>
> Obvious question: did you test the script in your local testing
> environment? unlink() definitely works on Windows, but it requires the
> correct permissions. Logically speaking, you should be able to delete
> items from the same folder that you created them in, but computer logic
> doesn't always follow the same rules as human logic.
>
> --
> David Powers
> Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
> http://foundationphp.com/


Inspiring
September 5, 2006
Murray *ACE* wrote:
> I don't want to thrash with this. Where do you suggest I go to try to get
> an answer?

You could try the PHP-general mailing list. It's frequented by some of
the guys who write the core code for PHP.

> I have just this one thing I need to do - Delete images that I have
> uploaded.

Obvious question: did you test the script in your local testing
environment? unlink() definitely works on Windows, but it requires the
correct permissions. Logically speaking, you should be able to delete
items from the same folder that you created them in, but computer logic
doesn't always follow the same rules as human logic.

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
Inspiring
September 5, 2006
I don't want to thrash with this. Where do you suggest I go to try to get
an answer?

I have just this one thing I need to do - Delete images that I have
uploaded.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"David Powers" <david@example.com> wrote in message
news:edk5o8$4fk$1@forums.macromedia.com...
> Murray *ACE* wrote:
>> It appears that permissions are being set at 666 when I upload the file.
>
> Not on a Windows server, they're not. Windows uses a different set of
> permissions. If you were on a *nix server you might be able to use umask()
> to set the permissions of an uploaded image, but I don't know of any way
> to do it with Windows and PHP.
>
> --
> David Powers
> Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
> http://foundationphp.com/


Inspiring
September 5, 2006
It's the production server, unfortunately.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Joe Makowiec" <makowiec@invalid.invalid> wrote in message
news:Xns983572AFBEEA4makowiecatnycapdotrE@216.104.212.96...
> On 05 Sep 2006 in macromedia.dreamweaver.appdev, Murray *ACE* wrote:
>
>> It appears that permissions are being set at 666 when I upload the
>> file. This is devil spawn for sure....
>
> On a *nix box, you can change permissiosn. Not sure about that W*ndows
> box you're using. This is a testing server, right? Is the production
> server also Windows, or is it on a *nix box?
>
> --
> Joe Makowiec
> http://makowiec.net/
> Email: http://makowiec.net/email.php


Inspiring
September 5, 2006
I have access to those folders. I can upload files to them....

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"digitalus media" <webforumsuser@macromedia.com> wrote in message
news:edk522$3vs$1@forums.macromedia.com...
> this is just an idea, but if the images folder is in your site root you
> probably do not have the permission to go below that right? "..\\images\"


Inspiring
September 5, 2006
This is a Windows server. I can upload the file, but I cannot delete it.
Strange....

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"David Powers" <david@example.com> wrote in message
news:edk5o8$4fk$1@forums.macromedia.com...
> Murray *ACE* wrote:
>> It appears that permissions are being set at 666 when I upload the file.
>
> Not on a Windows server, they're not. Windows uses a different set of
> permissions. If you were on a *nix server you might be able to use umask()
> to set the permissions of an uploaded image, but I don't know of any way
> to do it with Windows and PHP.
>
> --
> David Powers
> Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
> http://foundationphp.com/


Inspiring
September 5, 2006
Murray *ACE* wrote:
> It appears that permissions are being set at 666 when I upload the file.

Not on a Windows server, they're not. Windows uses a different set of
permissions. If you were on a *nix server you might be able to use
umask() to set the permissions of an uploaded image, but I don't know of
any way to do it with Windows and PHP.

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
September 5, 2006
this is just an idea, but if the images folder is in your site root you probably do not have the permission to go below that right? "..\\images\"
Inspiring
September 5, 2006
On 05 Sep 2006 in macromedia.dreamweaver.appdev, Murray *ACE* wrote:

> It appears that permissions are being set at 666 when I upload the
> file. This is devil spawn for sure....

On a *nix box, you can change permissiosn. Not sure about that W*ndows
box you're using. This is a testing server, right? Is the production
server also Windows, or is it on a *nix box?

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/email.php