Jump to content

[SOLVED] Unlink problem?


darkfreaks

Recommended Posts

ok so i got

 

<?php

mysql_query("DELETE FROM vc_pics WHERE pic='$pic'");
mysql_query("DELETE FROM vc_pcomments WHERE pic='$pic'");
$link = "gallery/$pic";
unlink($link);
echo "Pics have been deleted<br>";

 

but i get

 

Warning: unlink(/www/vampirecity.cx-music.com/gallery/Pictures_4816.jpg) [function.unlink]: No such file or directory

 

 

how can i fix this?

 

Link to comment
Share on other sites

if($_POST['pics']) {
foreach($_POST as $pic) {
include ('config.php');
mysql_query("DELETE FROM vc_pics WHERE pic='$pic'");
mysql_query("DELETE FROM vc_pcomments WHERE pic='$pic'");
$link = "gallery/$pic";
unlink($link);
echo "Pics have been deleted<br>";

Link to comment
Share on other sites

here is my problem

gallery/Pictures_350.jpg
Warning: unlink(gallery/Pictures_350.jpg) [function.unlink]: No such file or directory in /home/www/vampirecity.cx-music.com/admindelete.php on line 120
Couldn't delete Pictures_350.jpggallery/Delete Pics
Warning: unlink(gallery/Delete Pics) [function.unlink]: No such file or directory in /home/www/vampirecity.cx-music.com/admindelete.php on line 119

Warning: unlink(gallery/Delete Pics) [function.unlink]: No such file or directory in /home/www/vampirecity.cx-music.com/admindelete.php on line 120
Couldn't delete Delete Pics

Link to comment
Share on other sites

see this

if($_POST['pics']) {
foreach($_POST as $pic) {

 

you're looping into your post data does it mean your post data only contain values of your images

what about your other post data it will also be inclided in your loop so even if you unlink some image

at the end you get error..

if you have other post other than $_POST['pics']

good sample is your POST submit that is part of your post

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.