LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-09-2005, 07:41 PM   #1
spoody_goon
Member
 
Registered: Sep 2003
Location: Michigan USA
Distribution: Mandrake, DamnSmallLinux, VectorLinux
Posts: 416

Rep: Reputation: 30
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
 
Old 05-10-2005, 06:33 AM   #2
Zhou
LQ Newbie
 
Registered: May 2005
Distribution: Knoppix 3.6 / Debian
Posts: 8

Rep: Reputation: 0
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.
 
Old 05-10-2005, 07:32 PM   #3
spoody_goon
Member
 
Registered: Sep 2003
Location: Michigan USA
Distribution: Mandrake, DamnSmallLinux, VectorLinux
Posts: 416

Original Poster
Rep: Reputation: 30
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

Last edited by spoody_goon; 05-10-2005 at 07:33 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
full path of a file ttilt Linux - General 1 11-08-2005 06:02 PM
How to parse full path of file name in bash ? hq4ever Programming 2 03-28-2005 03:31 PM
uploaded file on vsftpd has wrong file attributes rune.kg Linux - Newbie 2 03-06-2004 09:23 AM
Proftp-- I can upload now but I can't see the file I just uploaded HELP PLEASE funnyusa Linux - Newbie 4 06-22-2003 03:00 PM
Getting the name and path of an uploaded file in PHP4 Paulo Ges Programming 1 03-30-2003 07:23 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration