Your Ad Here Your Ad Here
Results 1 to 3 of 3

Thread: upload script

  1. #1
    blank BT Rep: +1
    Join Date
    Oct 2003
    Posts
    1,068
    ..
    Last edited by hungrylilboy; 01-08-2012 at 01:52 PM.

  2. Internet, Programming and Graphics   -   #2
    tesco's Avatar woowoo
    Join Date
    Aug 2003
    Location
    Canadia
    Posts
    24,069
    You only need the folder chmodded on a linux server, it just works on a windows one afaik.

    To make it work with files up to 100mb you need to have your host enable php to accept that big of files.


    Here's a basic code (upload.php):

    PHP Code:
    <?php

    if ($_REQUEST['do']=='upload')
    {
        if (
    move_uploaded_file($_FILES['uploadedfile']['tmp_name'], 'c:/www/uploads/'.basename($_FILES['uploadedfile']['name'])))
        {
            
    //Successful
        
    }
        else
        {
            
    //Not successful
        
    }
    }
    else
    {
        
    ?>

    <form enctype="multipart/form-data" action="upload.php?do=upload" method="POST">
        <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
        <input type="file" name="uploadedfile" />
        <input type="submit" value="Upload!" />
    </form>

        <?php

    }

    ?>
    Quote Originally Posted by php.net
    The contents of $_FILES from the example form is as follows. Note that this assumes the use of the file upload name userfile, as used in the example script above. This can be any name.
    $_FILES['userfile']['name']
    The original name of the file on the client machine.
    $_FILES['userfile']['type']
    The mime type of the file, if the browser provided this information. An example would be "image/gif". This mime type is however not checked on the PHP side and therefore don't take its value for granted.
    $_FILES['userfile']['size']
    The size, in bytes, of the uploaded file.
    $_FILES['userfile']['tmp_name']
    The temporary filename of the file in which the uploaded file was stored on the server.
    $_FILES['userfile']['error']
    This should get you started but remember there's more checks you'll need to do like file extension, file size, etc.
    To just get info on what was uploaded try
    PHP Code:
    print_r($_FILES); 
    If you need more info let me know what you want exactly and I can help.

  3. Internet, Programming and Graphics   -   #3
    blank BT Rep: +1
    Join Date
    Oct 2003
    Posts
    1,068
    ..
    Last edited by hungrylilboy; 01-08-2012 at 01:52 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •