Hi all

I have build an small personal form to delete images. (personal use only)
The respons I keep getting is "file not found..."

I use the script locAL (WAMP)

THIS IS THE FORM:

<form name="form" method="post" action="delete.php" >
  <label>delete
    <input type="text" name="delete" id="delete" >
  </label>
  <label>
    <input type="submit" name="send" id="submit"  >
  </label>
</form>

DELETE PHP

<?php

ini_set('display_errors',1); 
error_reporting(E_ALL | E_STRICT); 

if (   $_SERVER['REQUEST_METHOD'] == 'POST'
    && isset($_POST['delete']) && trim($_POST['delete']) != '') {



  if (file_exists($_SERVER['DOCUMENT_ROOT'].'/upload/'.$_POST['delete'])) {
       unlink();
    } 
    else {
        echo 'file not found....';
    } 
}
else {
   echo 'fill in something';
}      
?>

I have searched and tried some new code.

The files in upload are named "fashion.jpg" and "dog.gif"
I tried it with and without .jpg and .gif. but the only respons "file not found..
Thanks for the feedback

Okay what I would suggest doing is where you are echoing out the error message "file not found..." under that add the following line: echo "<br />" . $_SERVER['DOCUMENT_ROOT'] . "/upload/" . $_POST['delete']; This should bring a new line displaying the internal file system path that the system is looking for.

Hi Froger93
Thanks for the reply

This is the error message
C:/wamp/www/test_script/upload/fashion.jpg
Warning: unlink(fashion.jpg) [function.unlink]: No such file or directory in C:\wamp\www\test_script\delete.php on line 12

the backslashes are different
Is this possible to change an how?

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.