phpkode Posted October 8, 2010 Share Posted October 8, 2010 Dear forum I'm new to this forum and since I'm doing more and more php development, you'll probably going to see me more. For now I got this problem and I hope you guys can help me out =(. I'm building an administartion panel for a website. On this panel the administrator can upload pictures for a gallery. This part works, so normally permissions shouldn't be a problem. The file names are stored in my mysql database for example "pic2.jpg", "pic2.jpg", ... Now I got this form to delete pictures from a specific gallery. It deletes from the database but it just wont delete the files. I'm using a local xampp server. I got the following code: Code: $merk = $_POST["MerkLeegMaken"]; $sql = "SELECT * FROM catalogus WHERE merkId=" . $merk; $resultSet = mysql_query($sql); while ( $row = mysql_fetch_array($query) ) { $url = "../uploads/" . $row["foto"]; // this url is f.e. "../uploads/picture1.jpg", and I'm currently in "/administrationPanel/form.php fclose($url); unlink($url); } $sql = "DELETE FROM catalogus WHERE merkId=" . $merk; mysql_query($sql); $message = "<p class='success'>Het huidig merk is succesvol leeggemaakt.</p>"; (I got in my root dir the directory /uploads and the directory /administartionPanel, so ../uploads should be correct right?" I also tried to delete with "c:/xampp/xampp/htdocs/uploads/pic1.jpg" but that didn't work either. But shouldn't "../uploads/pic1.jpg" work anyway, since I use that same url as the source of an Image below the form. All my different url attempts didn't work. I kept finding the files in my windows explorer =( Hope someone can help. www.phpkode.com Quote Link to comment Share on other sites More sharing options...
$php_mysql$ Posted October 8, 2010 Share Posted October 8, 2010 is ut dir chmod to 777? Quote Link to comment Share on other sites More sharing options...
jl5501 Posted October 8, 2010 Share Posted October 8, 2010 You mention looking for names like pic1.jpg and pic2.jpg. In your code comment you give an example of picture1.jpg Are you sure the filenames you are trying to delete are exactly correct. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.