Jump to content

Help with creating directories/uploading files


babymac

Recommended Posts

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 by babymac
Link to comment
Share on other sites

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).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.