ZulfadlyAshBurn Posted February 8, 2011 Share Posted February 8, 2011 i have this code to show all the files in the users folder <?PHP session_start(); if(!isset($_SESSION['myusername'])){ header("location:index.php"); } else { $buildhtml = ""; $dirpath = "u/" . ($_SESSION['myusername']) . "/"; $dlist = opendir($dirpath); while ($file = readdir($dlist)) { if (!is_dir("$dirpath/$file")) { $buildhtml .= "<tr><td><a href=$dirpath$file>$file</a></td> <td> | <a href=edit.php?filepg=$file>Basic Editor</a> / <a href=edit1.php?filepg=$file>Advanced Editor</a> | </td> <td><a href=delete.php?fileitem=$file>*delete</a> | </td> <td><a href=rename.php?filepg=$file>*rename</a></td></tr>"; } } closedir($dlist); if (!empty($buildhtml)) { echo "Files in Storage</strong><table border='0'> <tr> <th>Filename</th> <th>Edit</th> <th>Delete</th> <th>Rename</th> </tr>" . $buildhtml . "</table>"; echo "Click on it to download<br>"; echo "Notice: Only html/txt files are editable"; } else { echo "The folder is <strong>empty</strong>! Please upload!."; } } ?> its shows everything correctly. but if the file have space, it will just link to the first word. how do i enable the spaces? Link to comment https://forums.phpfreaks.com/topic/227063-help/ Share on other sites More sharing options...
BlueSkyIS Posted February 8, 2011 Share Posted February 8, 2011 urlencode($file) Link to comment https://forums.phpfreaks.com/topic/227063-help/#findComment-1171430 Share on other sites More sharing options...
ZulfadlyAshBurn Posted February 8, 2011 Author Share Posted February 8, 2011 where should i place the urlencode($file); Link to comment https://forums.phpfreaks.com/topic/227063-help/#findComment-1171437 Share on other sites More sharing options...
Pikachu2000 Posted February 8, 2011 Share Posted February 8, 2011 HTML <a> tag markup isn't valid without the href attribute values in quotes either. $buildhtml .= "<tr><td><a href=\"$dirpath$file\">$file</a></td> Etc. . . . Link to comment https://forums.phpfreaks.com/topic/227063-help/#findComment-1171454 Share on other sites More sharing options...
ZulfadlyAshBurn Posted February 8, 2011 Author Share Posted February 8, 2011 thanks. it works. Link to comment https://forums.phpfreaks.com/topic/227063-help/#findComment-1171463 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.