hesyar Posted November 16, 2006 Share Posted November 16, 2006 Hello,Can somebody help me!?I want to show all files in a map and that by name sortI have got now this one but it doesn't sort:[table][tr][td]<?php if (isset($_FILES['datei']) and ! $_FILES['datei']['error']){ $filename = $_FILES['datei']['name']; move_uploaded_file($_FILES['datei']['tmp_name'], $dir."aufgaben/".$filename); echo "<b>Status:</b> Upload komplett"; } else { echo ""; }?>[/td][/tr][/table]And i want to show in a table column the last 10 uploads please Help Me!!Can somebody give a exemple? Quote Link to comment Share on other sites More sharing options...
btherl Posted November 17, 2006 Share Posted November 17, 2006 Do you want to show all files in a folder (Mappe), sorted by name?These may help:http://sg.php.net/manual/en/ref.dir.phphttp://sg.php.net/manual/en/function.glob.phpglob() sorts by name already.And I suggest you change the topic from "Sort mapfiles" to "Sort directory files" or "Sort folder files" :)Mach Spass :) Quote Link to comment Share on other sites More sharing options...
Seraskier Posted November 17, 2006 Share Posted November 17, 2006 what you could possible do is make it do is add it to the database and tell the query to list by name. I'm hand coding this script so I dont know if it will work 100% or not. Good Luck.[code]<?phpmysql_connect("HOST", "USERNAME", "PASSWORD");mysql_select_db("DATABASE NAME");$_max_file_size = "20000000";echo "<form enctype='multipart/form-data' action='?do=upload_do' method='POST'>";echo "<input type='hidden' name='MAX_FILE_SIZE' value='" . $_max_file_size . "' />";echo "<input name='userfile' type='file'>";echo "<input type='submit' value='Upload'>";echo "</form>";if($_GET['do'] == 'upload_do'){$_file_upload_name = $_FILES['userfile']['name'];$uploadfile = $_user . "/" . basename($_FILES['userfile']['name']);if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { header("Location: ?view=files"); }$_file = $_POST['file'];$result = mysql_query("INSERT INTO files (file) values ('$_file')");header("location:?view=files");else { echo "<b>Could not upload file.</b><br>";}}if($_GET['view'] == 'files'){$result6e = mysql_query("SELECT * FROM files ORDER BY name") or die(mysql_error()); while($row6e = mysql_fetch_array( $result6e )) {echo ". $row6e['name'] . "<br />";}}?>[/code]Now remember i just coded that so I dont know what bugs it may run into. You are going to have to go through the code and edit it. Now in your database you will have to make a table named "files" and then put in your database information in the first few lines. Thanks. Reply or message me if you have any questions or need help on something. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.