Reputation: 753
I have tried everything to get a full path printed when I click on the Browse button and I tried to get help from the community:
Writing the full path of the file when it is browsed using php
But apparently for security reasons it is not possible. So I have tried to find a way around it. Since I know the location of the files that I am browsing (the user doesn't know it) I have copied the URL in a text file and used inclue to read the URL from the text file and put it in a text box on my webpage.
<input name="A" type="text" VALUE="<?PHP echo include("/var/www/html/test.txt");?>" size="20">
Something odd happens in the text box and there is always a "1" added for some reason at the end of the URL. For example, instead of
www/htdocs/inc
I get
www/htdocs/inc1
in the text box.
Any idea what's going on?
Upvotes: 1
Views: 30
Reputation: 76646
The include
statement includes and evaluates the specified file. It's used when you want to include additional PHP code. In this case, you're just wanting to output what's in a text file, so you don't need include
. You can just use file_get_contents()
instead:
VALUE="<?PHP echo file_get_contents("/var/www/html/test.txt");?>"
Upvotes: 2