babymac Posted May 19, 2013 Share Posted May 19, 2013 (edited) Hi everyone, I'm working on an assignment and am looking for some advice as to where to start. What I'm trying to do: "Create a form and a script to upload files into a directory. If that directory does not exist, create it with 0777 permissions. Use ‘getcwd’ function to ensure that the script can be ported from machine to machine (Use varying file sizes for use in part 2)." then "Create a script to loop through the directory where you are uploading files to. List the directory contents in order by file size. (Tip: create an array of all the file names and file sizes, then use one of the array sort functions to sort them by file size.) Loop through the final, sorted array and print out the file name and file size to a text file outside the uploaded file directory." I'm not looking for someone to do my work, I'm just totally lost and don't know where to even look. Here's the small amount of code I have so far. :/ Help? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://wwww.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title> Input Form </title> </head> <body> <p><h3>Please upload file(s):</h3></p> <form enctype="multipart/form-data" action="pa3.php" method="POST"> File 1: <input type="file" name="file1" maxlength="20000"/><br/> File 2: <input type="file" name="file2" maxlength="10000"/><br/> File 3: <input type="file" name="file3" maxlength="15000"/><br/> <input type="submit" name='enter' value="Upload Files" /><br/> </form> </body> </html> <?php // Create the directory: mkdir ("/path/to/my/dir", 0777); ?> Edited May 19, 2013 by babymac Quote Link to comment Share on other sites More sharing options...
ginerjm Posted May 21, 2013 Share Posted May 21, 2013 Hope you're still doing your homework and not waiting for someone to earn your grade for you. You have a lot of reading to do in order to learn some stuff. There are millions of examples out there in google-land on how to do this. You don't need this forum (yet). 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.