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
https://forums.phpfreaks.com/topic/89271-solved-unlink-problem/
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
https://forums.phpfreaks.com/topic/89271-solved-unlink-problem/#findComment-457112
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
https://forums.phpfreaks.com/topic/89271-solved-unlink-problem/#findComment-457146
Share on other sites

depends upon your server. first, try replacing $link with an actual file address on your server. if you still get this error, i would try it on a different server, because unlink does not work for me on some sites and I get the same error you are getting even though the file actually exists.

Link to comment
https://forums.phpfreaks.com/topic/89271-solved-unlink-problem/#findComment-457190
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
https://forums.phpfreaks.com/topic/89271-solved-unlink-problem/#findComment-457225
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.