need help with deleting files from uploaders

Started on the old forum in January 2010 · view the original in the archive · old links redirect here

4 replies · 339 views · started 16 years ago · 1 min read

3 participants
nclemale36 Lead · 537 posts #1

here is my mp3 uploaders . i have a delete file i got from somewhere else but i get an error.

can someone look at it please.

even if it just deletes it from the database would be good thanks.

error is on line 54 in the delete.php Warning: Division by zero in /home/wapchat4/public_html/mp3s/delete.php on line 54

Warning: unlink() [function.unlink]: Unable to access in /home/wapchat4/public_html/mp3s/delete.php on line 54 Error! Sorry file cannot be deleted.

it still deletes it from database even with that error but not the file itself

Attachments: mp3s.rar
nclemale36 Lead · 537 posts #2
else
{
$row = mysql_fetch_array(mysql_query("SELECT filename FROM dave_mp3 WHERE id='".$file."'"));
$a = unlink(files/$row[0]);                                                                                          <<<<<<<<<<<<<< line 54 
$b = mysql_query("DELETE FROM dave_mp3 WHERE id='".$file."'");
echo ($a && $b)? "File has been deleted successfully":"Error! Sorry file cannot be deleted.";
}

anyone help me with this

crazybrumi Super moderator Principal · 1,064 posts #3

dont put a=unlink bladi blad,

just leave it as unlick, but what u want to do is something like this. depending what u got in filename if it is only the filename u can do this

$row = mysql_fetch_array(mysql_query("SELECT filename FROM dave_mp3 WHERE id='".mysql_real_escape_string($file)."'"));
unlink("./$row[0]");                                                                                
mysql_query("DELETE FROM dave_mp3 WHERE id='".mysql_real_escape_string($file)."'");
echo"File has been deleted successfully":"Error! Sorry file cannot be deleted.";
}

try that, depending what page ur deleting it and what part of directory is u might have to change the unlick() part to suit it.

Want something coded email me at sales@webnwaphost.com for a prices.

http://flagcounter.com/more/W80q

thanatos Senior · 261 posts #4

Try this

$a = unlink("files/$row[0]");

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close