Results 1 to 4 of 4

Thread: Get path of selected file

Threaded View

  1. #1

    Thread Starter
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Get path of selected file

    I've got an option where a user can browse for a file using the code below.

    What I want to know is how to get the full path of the file selected?

    PHP Code:
    if ($_POST['submit'] == "") {

    ?>
    <form enctype="multipart/form-data" action="<?php echo($_SERVER['PHP_SELF']) ?>" method="post"> 
    File:<br>
     <input type="file" name="file1" size="75"></p> 
    <p><input type="submit" value="Post" name="submit"></p> 
            </form> 

    <?
    }
    else {
    $file = $_FILES['file1']['name'];
    //$file = test.txt
    //I want $file = C:\test.txt etc...
    echo "File to upload is ($file)";

    }

    Also, is there a way to restrict the type of files that are displayed when the "browse" button is clicked? eg. only .txt or .csv etc...
    Last edited by lintz; Sep 20th, 2006 at 01:11 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width