Results 1 to 3 of 3

Thread: Upload File

  1. #1
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default Upload File

    Hi guys...

    I'm developing a backend and I need to upload 2 images at the same time.

    I got it to work with only one image upload. But I can't figure out how to do this with 2 input file type fields at the same time.

    Here is what I'm working with:

    PHP Code:
    $fimage=$_FILES['fimage']['name'];
        
    $fthumb=$_FILES['fthumb']['name'];

       
    //upload file
       
    $target_path "upload/";

        
    $target_path $target_path basename$_FILES['fimage']['name']); 
        
        if(
    move_uploaded_file($_FILES['fimage']['tmp_name'], $target_path)) {
            echo 
    "The file ".  basename$_FILES['fimage']['name']). 
            
    " has been uploaded";
        } else{
            echo 
    "There was an error uploading the file, please try again!";
        }
       
    //end upload file 

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Just use the code twice and change it to reflect the second field name and destination filename.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Thanks

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
  •