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.