#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    27
    Rep Power
    0
    How can i make a form which can be used to upload a file with php?

    Pieter
  2. #2
  3. No Profile Picture
    Nightwork
    Guest
    Devshed Newbie (0 - 499 posts)
    (HTML code):

    <FORM ACTION="upload.phtml" METHOD=POST ENCTYPE=multipart/form-data">
    <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="10000">
    Submit this file: <INPUT TYPE=FILE NAME="userfile"><BR>
    <INPUT TYPE=SUBMIT><BR>

    (PHP code):
    <?php

    if (copy($userfile, "../temp/$savefile")){
    echo(" File Saved Successfully. ");
    }
    else {
    echo (" Error, file cannot be saved.");
    }

    ?>

    I think this might do the trick, although I found out uploading through a browser isn't like 100% bulletproof.

    Jeroen

Similar Threads

  1. Replies: 2
    Last Post: August 18th, 2004, 11:45 PM
  2. uploading from php form / generating mysql value
    By emp/ir:kal in forum PHP Development
    Replies: 2
    Last Post: February 9th, 2004, 10:30 PM
  3. Uploading file thru PHP Script ..
    By Rubal in forum IIS
    Replies: 2
    Last Post: January 28th, 2004, 03:17 AM
  4. PHP with UnixODBC
    By coder4hire in forum PHP Development
    Replies: 2
    Last Post: January 20th, 2004, 02:14 PM
  5. UnixODBC + PHP + Apache + Empress
    By coder4hire in forum Database Management
    Replies: 0
    Last Post: January 15th, 2004, 02:41 PM

IMN logo majestic logo threadwatch logo seochat tools logo