Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Upload feedback

  1. #1
    New Coder
    Join Date
    Feb 2006
    Location
    Las Vegas
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Upload feedback

    Hello, I'm making a simple upload form and I was just wondering how to say, "The file name is _______" and then post the name of the file that was used in the form.... is that possible with my code??


    Code:
    <?php
    
           if($_FILES['fild']['name']){
                   $file_path = $_FILES['fild']['tmp_name'];
                   $file_name = $_FILES['fild']['name'];
                   $file_size = $_FILES['fild']['size'];
                   $file_type = $_FILES['fild']['type'];
                   $file_error = $_FILES['fild']['error'];
    
                   if(is_uploaded_file($file_path)){
                           copy($file_path, $file_name) or die('There was an error while uploading your file. Please try again.');
                           echo('Your file has been uploaded.<br>Thank you!');
    					   }
           }else{
    ?>    
    
    <form method="post" enctype="multipart/form-data">
                     <input TYPE="file" name="fild">
                     <input name="submit" type="submit" value="Upload" />
    </form>
             <?php
           }
    ?>

  • #2
    New Coder
    Join Date
    Oct 2006
    Posts
    82
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Try this...


    PHP Code:

    echo "The file name is ".$_FILES['fild']['name']; 

  • #3
    New Coder
    Join Date
    Feb 2006
    Location
    Las Vegas
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank You, I knew it was something simple like that I just couldnt remember


  •  

    Posting Permissions

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