title: How can I pass a full file name through a web form?
body: <p>So as it stands I have a form that hands a file to my server. What I am interested in doing is sending only the files full name to the server. Currently, my code is as follows:</p>
  
  <pre><code>&lt;form action="upload.php" method="POST" &gt;
      &lt;table align="center"&gt;
          &lt;tr&gt;
              &lt;td align="right"&gt;
                  Select your file to upload:
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;input name="userfile" type="file" size="50"&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
      &lt;table align="center"&gt;
          &lt;tr&gt;
              &lt;td align="center"&gt;
                  &lt;input type="submit" name="submit" value="Upload image" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>When the form passes to upload.php, the value I get for $_POST['userfile'] is the 'name' of the file I am handing up. I am looking to get the full path out of this field, rather than just a filename. I wonder if anyone has any recommendations for a client-side file browser that can hand this back, or perhaps another way to evaluate this form to get that data, I would greatly appreciate it. I've tried adding 'enctype="multipart/form-data"' to the form definition, and what is actually really surprising is that I don't get any form info on my upload page - which is an entirely different problem. Anyway, thanks for any help.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Elaborate on my question...
  I'm trying to upload large files to my web server. HTTP Forms break after 100 megs or who knows. FTP is difficult to manage on 30 systems with 10 different users that have no idea how to determine why their client can't connect. I'm writing a web form to upload files to my server when these people are done with them. I am trying to find a solution to do this. The above script, is supposed to hand my full file path to the following script:</p>
  
  <pre><code>&lt;?
  set_time_limit(300);
  
  var_dump($_FILES);
  var_dump($_POST);
  $filep=$_POST['userfile'];
  $name=$_POST['userfile']['name'];
  
  echo($filep);
  echo($name);
  $paths="test";
  $ftp_server="localhost";
  $ftp_user_name="digitaljedi";
  $ftp_user_pass="dontworryaboutit";
  
  // set up a connection to ftp server
  $conn_id = ftp_connect($ftp_server);
  
  // login with username and password
  $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
  
  // check connection and login result
  if ((!$conn_id) || (!$login_result)) {
      echo "FTP connection has encountered an error!";
      echo "Attempted to connect to $ftp_server for user $ftp_user_name....";
      exit;
  } else {
      echo "Connected to $ftp_server, for user $ftp_user_name".".....";
  }
  
  // upload the file to the path specified
  $upload = ftp_put($conn_id, $paths.'/'.$name, $filep, FTP_BINARY);
  
  // check the upload status
  if (!$upload) {
      echo "FTP upload has encountered an error!";
  } else {
      echo "Uploaded file with name $name to $ftp_server ";
  }
  
  // close the FTP connection
  ftp_close($conn_id);    
  
  ?&gt;
  </code></pre>
  
  <p>If I add an encoding type to the form, I end up with NO $_POST data, and NO $_FORM data in upload.php, but rather, undefined indexes to 'userfile'. As it sits; If I upload say... 'C:\users\digitaljedi\wtf.txt' - I end up with 'wtf.txt' on the other end. </p>
  
  <p>.....</p>
  
  <p>I just tried adjusting my PHP to use a static path, rather than one from the form, and I end up not being able to open the file anyway. Apparently ftp_put uses the server filesystem, which completely negates my entire theory here.</p>
  
  <p>Now what I want to know is this; is there NO solution for uploading large files through a web page? I found a flash uploader, but it seems to be capped at 100 megs ( documentation says that this is all flash allows ). This is becoming more trouble than it's worth.</p>