I have some files that I want to access from a script that is running on my C drive in localhost. I have tried using ../ in front of the file name to go up a directory level but the php code seems to prefix everything with http://localhost.
I am using XAMPP 1.7.3! for Windows, Apache 2.2.14 and PHP 5.3.1
Some advice would be most appreciated.
Ian
accessing files outside localhost
Moderator: General Moderators
- ganesh_dabhade
- Forum Newbie
- Posts: 19
- Joined: Sun Feb 06, 2011 12:42 am
- Contact:
Re: accessing files outside localhost
Access the files with physical path.
Re: accessing files outside localhost
But if you take this to an online server, you wont be able to access you hard disk from there. Just a thing to remember 
Dom
Dom
Re: accessing files outside localhost
Thanks for the reply Ganesh but I tried to do that.ganesh_dabhade wrote:Access the files with physical path.
I set up a variable of $image = "C:/etc" and tried to displat the file with <img width='950' src='$image' /> but the code generated
http://localhost/C:/etc
Any other ideas or have I done something silly in my code?
Ian
- ganesh_dabhade
- Forum Newbie
- Posts: 19
- Joined: Sun Feb 06, 2011 12:42 am
- Contact:
Re: accessing files outside localhost
try to use file protocol
file:///c:/etc instead of c:/etc
You won't be able to access files on server. You have to change ur scripting policy.
Post the thing u want to do, I'll try my best.
file:///c:/etc instead of c:/etc
You won't be able to access files on server. You have to change ur scripting policy.
Post the thing u want to do, I'll try my best.
Re: accessing files outside localhost
ganesh_dabhade wrote:try to use file protocol
file:///c:/etc instead of c:/etc
You won't be able to access files on server. You have to change ur scripting policy.
Post the thing u want to do, I'll try my best.
Thanks Ganesh but I have had the following reply from Larry Ullman so I will have to move the file into local host:-
'You can't access them directly. A Web server can only provide documents found within the Web directory. To accomplish what you're trying to do you'll need to use a proxy script. I'm pretty sure the book has an example of one, and I also just wrote about this in a recent newsletter (see the main site pages for that).'
Thanks once again
Ian