Results 1 to 2 of 2

Thread: uploading form

  1. #1
    Join Date
    Jun 2005

    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,
    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
    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" />
    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'])
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

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