unlink (php file deletion won't work)

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
murfituk
-


Joined: 03 May 2007
Posts: 2

PostPosted: Mon May 19, 2008 11:10 am    Post subject: unlink (php file deletion won't work) Reply with quote

Got a script that takes a few jpgs, adds watermarks, saves the new images in a folder, takes all the images and puts them in a zip. Then the script goes through and unlinks all the new jpgs. Can delete them because they are now all zipped up.

Get a warning about not having permission to delete eg

Warning: unlink(users/5120204.jpg) [function.unlink]: Permission denied in C:\Program Files\Abyss Web Server\htdocs\WebSites\Contacts\createzip.php on line 58

Everything else works OK. it's just the files don't get deleted. I can put a @ in front of unlink to supress the warning but it only hides the problem.

What do I have to do? I've got a windows XP, abyss X1 v2.4, PHP 5.2.1. I've tried right-clicking the users folder and untick Read Only, but to no avail.

Many thanks.
Back to top View user's profile Send private message
chewzzqq
-


Joined: 28 Sep 2005
Posts: 198

PostPosted: Mon May 19, 2008 4:15 pm    Post subject: Reply with quote

i think other is still browsing to it,
so it cant be delete ?
or you just restart you system ,and try to delete again?
_________________
Back to top View user's profile Send private message Visit poster's website
Toasty
-


Joined: 21 Feb 2008
Posts: 298
Location: Chicago, IL

PostPosted: Mon May 19, 2008 11:46 pm    Post subject: Reply with quote

Make sure that the scripts that you're using close the file resource before it tries to delete the files.

If it does, and you're still getting problems, you might have a permission issue coming from your PHP.INI...But where that would lye, I'm not sure.


Look into this command:
imagedestroy();


See if that suits your needs.


-Toasty
_________________
Audit the secure configuration of your server headers!
Back to top View user's profile Send private message Visit poster's website
murfituk
-


Joined: 03 May 2007
Posts: 2

PostPosted: Tue May 20, 2008 2:41 am    Post subject: Reply with quote

Toasty - you were spot on.

I was in a for loop (from 1 to number_of_pages),
creating the watermarked image using a function, saving it, putting it in the zip and then trying to delete the image. Wouldn't work.

Had to close the zip first and then create a second loop to go through and delete 'em.
Back to top View user's profile Send private message
Toasty
-


Joined: 21 Feb 2008
Posts: 298
Location: Chicago, IL

PostPosted: Tue May 20, 2008 5:20 am    Post subject: Reply with quote

Glad I could help.
_________________
Audit the secure configuration of your server headers!
Back to top View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group