tags:

views:

25

answers:

2

For Attachment i am using the below mentioned code <input type="file" name="attachcopy" id="attachcopy" /> in my for to get input from the user. my problem is how to get the inputbox path. i need a file original path. i am using this code

if ($_FILES["file"]["error"] > 0)
  {
  echo "Error: " . $_FILES["file"]["error"] . "<br />";
  }
else
  {
  echo "Upload: " . $_FILES["file"]["name"] . "<br />";
  echo "Type: " . $_FILES["file"]["type"] . "<br />";
  echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
  echo "Stored in: " . $_FILES["file"]["tmp_name"];
  }

But this code returns temporary copy of the file stored on the server. How to get the exact address that is shown in the Input box. please guide me thanks in advance

+4  A: 

I don't even think that's possible. Not with PHP at least. Being a server-side language, PHP only has access to what actually gets on the server, in your case, the temporary file name, original filename, size and such. But not the location on the user's computer, no way...

Claudiu
+1  A: 

The client-side path is just that: client-side. The user's browser may choose to send it, but generally most just send the name of the and nothing else. Given the security restrictions placed on file upload <input> boxes, there's no way for you to retrieve it if the browser chooses to not send it. You can't do anything PHP-side to extract the information, and Javascript is extemely limited in what it can do on the client-side.

Marc B