title: Upload files using list box in PHP
body: <p>I want to upload files from a list box in php.</p>
  
  <p>I am able to do it by using <code>&lt;input type="file"&gt;</code> which I found on <a href="http://www.tizag.com/phpT/fileupload.php" rel="nofollow noreferrer">http://www.tizag.com/phpT/fileupload.php</a></p>
  
  <p>But when I change this <code>&lt;input type="file"&gt;</code> by <code>&lt;select&gt;</code></p>
  
  <p>i am trying this way</p>
  
  <pre><code>&lt;form enctype="multipart/form-data" action="upload.php" method="POST"&gt;
  &lt;input type="hidden" name="MAX_FILE_SIZE" value="100000" /&gt;
  Choose a file to upload: &lt;input name="uploadedfile" type="file" /&gt;
  &lt;select name="uploadedfile" id = "fileName" size="3" style="width: 100%"&gt;
  &lt;option id = "uploadedfile" value="c:\text.txt"&gt;c:\text.txt&lt;/option&gt;
  &lt;/select&gt;
  &lt;input type="submit" value="Upload File" /&gt;
  &lt;/form&gt; 
  </code></pre>
  
  <p>and PHP code remains the same for both cases</p>
  
  <pre><code>&lt;?php
  $target_path = "uploads/";
  $target_path = $target_path . basename( $_FILES['uploadedfile']['value']); 
  
  
  if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
      echo "The file ".  basename( $_FILES['uploadedfile']['value']). 
      " has been uploaded";
  } else{
      echo "There was an error uploading the file, please try again!";
  }
  
  ?&gt;
  </code></pre>
  
  <p>it does not work........</p>
  
  <p>Regards
  Hemant</p>