need help with deleting files from uploaders

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    need help with deleting files from uploaders

    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
    Attached Files
    Last edited by nclemale36; 10.01.10, 15:35.
    Wapchat4u


    Topsites4u

    #2
    Code:
    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
    Wapchat4u


    Topsites4u

    Comment


      #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

      Code:
      $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.




      Comment


        #4
        Try this
        Code:
        $a = unlink("files/$row[0]");

        Comment


          #5
          thanks thanatos that works a treat. just need to tweak it and make it safer . cheers brumi too
          Wapchat4u


          Topsites4u

          Comment

          Working...
          X