www.webdeveloper.com
Results 1 to 2 of 2

Thread: uploading form

  1. #1
    Join Date
    Jun 2005
    Posts
    411

    uploading form

    I need the html form that uploads a file to the server, i can do this with php already but i need the form that allows the user to pick which file he wishes to upload and i also need to know the way to shorten down the file name from "C:\Documents and Settings\Username\My Documents\My Pictures\picture.jpg" to "picture.jpg" all help is greatly appreciated,
    thanks
    HTML skill level: Good
    Javascript skill level: somewhere between poor and good
    php: good but still getting better
    sql: good but still getting better

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,176
    As per http://www.php.net/manual/en/feature...ad.post-method , the form will need to look something like:
    HTML Code:
    <!-- The data encoding type, enctype, MUST be specified as below -->
    <form enctype="multipart/form-data" action="__URL__" method="POST">
        <!-- MAX_FILE_SIZE must precede the file input field -->
        <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
        <!-- Name of input element determines name in $_FILES array -->
        Send this file: <input name="userfile" type="file" />
        <input type="submit" value="Send File" />
    </form>
    In this example, since the file form element is named "userfile", the PHP form-handler could get the file name as: basename($_FILES['userfile']['name'])
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles