LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   get full path of uploaded file in php (https://www.linuxquestions.org/questions/programming-9/get-full-path-of-uploaded-file-in-php-321798/)

spoody_goon 05-09-2005 07:41 PM

get full path of uploaded file in php
 
I have a php program that will upload html files and manipulate them. I want to get the full path of the file on the remote user. For instance
$_FILES['UseTemplate']['name']; will get me the name of the file but not he full path that appears in the web browser
$_FILES['UseTemplate']['tmp_name']; will get me the full path of the file on the server.

Why? I want to prompt the user to upload the image files that go with the html page and it might help if they had the full location.

e.g. if a file is located a /home/username/test.html and the image file is located a /images/pictname.jpg it would be nice to but in the file file box /home/username/images/pictname.jpg elimination the need fo them to browse for the image.

and ideas?
Thanks

Zhou 05-10-2005 06:33 AM

I do not think that this is possible. It is most probably considered undesirable to provide a server with information on where files lie on your local hard disk.

You may try your luck with
print_r($_FILES) to see everything that is provided by the user.

spoody_goon 05-10-2005 07:32 PM

Zhou your right it's not a good idea to provide a server wtih the location of file on your hard disk. I simply want to find out what images goes with the html file already uploaded and "fill in the blanks" rather than have the user have to browse for each file individually.

I recently tested that I can get the file path with javascript an onsubmit fuction like this:
Code:

<script>
function checkfile()
{
var filename;
filename = document.formname.test.value;
alert (filename);
}
</script>

from there it's just a matter of parsing off the file name.
Let me be clear I have no desire to do anything other than "guide" the user to files needed for the html file to display correctly. As a matter of fact I will make sure the path I am after will be out in the open for the user to see.
Thanks


All times are GMT -5. The time now is 11:10 PM.