unlink() not working for *.zip files

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
rprins
Forum Commoner
Posts: 31
Joined: Sat Jun 21, 2003 5:46 pm

unlink() not working for *.zip files

Post by rprins »

Alright, I am stumped on this.

I have created a script to let users upload ZIP files to a pre defined directory. Now, when they go to delete them from the script the script says "Access Denied in /home/blah/blah/ etc..." But, the funny thing is that the file's CHMOD is 0775. So, I am really confused on how to solve this issue.

I am reusing code from another script and it is setup exactly the same, but it works in the other script (to upload jpgs). So, any help you could offer would be more than appreciated. If you need more info, let me know.

Here is the delete code:

Code: Select all

<?php
		case "delete":
			switch($c){
				case "confirm":
					echo "Are you sure that you want to delete your config?<br>
							>> <a href="$PHP_SELF?action=delete&c=del">Yes - I don't want people playing like me</a><br>
							>> <a href="$PHP_SELF?action=delete">No - On second thought, let them play with my hacks</a><br>
							$current_csconfig";
				break;
				case "del":
					$del_file = unlink($current_csconfig);
					if($del_file){
						echo "Ok, you had your way, your config is gone!<br>
							If you change your mind you can go to the <a href="$PHP_SELF">config upload</a> page to change your config.<br><br>
							<b>You can return to:</b><br>
							-<a href="./index.php">Admin Index</a><br>
							-<a href="../index.php">Main Index</a><br>";
					} else {
						echo "<b>Error!</b> Could not delete config.";
					}
				break;
			}


?>
Where:

Code: Select all

<?php $current_csconfig = "../files/user_configs/" . $usernumber . ".zip";
?>
File structure:

Code: Select all

|
|----admin (where script is ran)
|
|----files/user_configs/ (where files are placed)
Post Reply