About removing an absolute path to a file ask for a question

Source: Internet
Author: User
Find out the absolute path problem of deleting files
PHP Code
  
     Delete_files.php$dir = "Uploadfiles";//Set File save directory note include/   $id =$_get[' delete '];    $conn =mysql_connect (' localhost ', ' root ', ');    $flag =mysql_select_db (' Laborder ', $conn);    mysql_query ("Set names UTF8");    $sql = "SELECT * from Files where files_id= ' $id '";    $sqlupdate = "Delete from student where student_id= ' $id '";     $result =mysql_query ($sql, $conn);         if ($lists =mysql_fetch_array ($result))         {$name = $lists [' Files_name '];           $a =dirname (__file__);           $i =unlink ($a/$dir/$name);                  if (mysql_query ($sqlupdate) && $i)                  {                                                echo "";                         echo "";                                         }         }

This is what I do delete the file code, delete the file at the same time to remove his name from the database, can not implement the deletion of files, unlink delete files absolute path bar, with DirName (__file__) to obtain this file according to the path, $dir is the folder to delete files, Ask what is wrong, novice seeking guidance. File structure is www/test5/uploadfiles/to delete files www/test5/delete_files.php this file



------Solution--------------------
First $a/$dir/$name This echo look, the address is not
------Solution--------------------
PHP Code
$xxx = "{$a}/{$dir}/{$name}"; echo $xxx; unlink ($xxx);
------Solution--------------------
Path to the right, permission to have, must be a file
------Solution--------------------
Explore
E:\work\wamp\www\test5/uploadfiles/sobel operator. doc}
According to the 3 floor change, there was this warning.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.