1

I am trying to implement a way for user to delete files. I am using the code below but it doesn't delete the files. This file is under the root and i checked and made sure that it has permissions to allow users to do what they want, so i am thinking its the script:

 $sql = "select `File` from `documents` where `user_id` = '$userid' and `doid` = '$doid'"; $query = mysql_query($sql) or die ("Error: ".mysql_error()); while ($row = mysql_fetch_array($query)){ $fn = $row['File']; } mysql_free_result($query); unlink(/userstash/$fn); 

1 Answer 1

6

unlink($file) is the correct function to delete a file.

Check if the $fn is filled. And try to use.

unlink('/userstash/' . $fn); 
Sign up to request clarification or add additional context in comments.

1 Comment

Yup. It says i have to wait a few mins before i can select it.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.