Jul 9, 2008

Iframe Src = A Local File In My Computer

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > HTML, XML etc..

free web hosting

Iframe Src = A Local File In My Computer

BuffaloHELP
Is it possible to call a file, i.e. 1.htm, from my web browser using such tag

HTML
<iframe src="file:///C:/1.htm">

</iframe>


file:///C:/1.htm is the correct path since when I enter it to my web browser's address box it shows up properly. But when I use the same call function in my PHP it does not.

My situation is that I'm running Apache with PHP, therefore I am running my own mimi-webserver on my computer. There's no risk of someone else accessing my file because it's for my testing purpose.

I thought it had to do with some Apache setting but I cannot seem to overcome this obstacle. Any HTML or Apache gurus out there, if you have a solution to call localized file to a browser using any HTML markup I would be appreciated smile.gif

 

 

 


Reply

truefusion
I once saw an advertisement for anti-spyware that loaded my C: drive into an iframe—quite ingenious i might add. But the code you provided in the HTML bbcode should work in the browser, since you're providing the absolute path. In PHP, you do not include "file:///" in functions or statements; in print and echo statements it's optional. I am unsure of any other possible reasons why it would not work.

Reply

jlhaslip
BH,

seems that the html file you call needs to be accessible from your local web server and the http protocol needs to call the file.

CODE
<iframe src="http://localhost/char_test.php" width="640" height="400" /></iframe>


Works for me in my localhost from an html file, and the php inside the iframe gets properly parsed, too.

Reply

BuffaloHELP
Browsers since IE5 and such alike have released a security patch to prevent IFRAME from opening local file--as truefusion mentioned why it was necessary.

I am trying to circumvent this restriction and perhaps only allow 'localhost' to access files outside of 'htdocs.'

htdocs is the default folder set by Apache to store and view server files (C:/Program Files/Apache/htdocs). Only files within htdocs, aka localhost, can be accessed using http: //localhost/... This is so that if your computer is servicing web files, you wouldn't want outside browsers to view any of servers root files/folders. So anytime //localhost/folder/file is called it is still within the confines of htdocs folder.

Apache configuration allows me to change where 'htdocs' is located but I do not want to set it as C:/ This is dangerous. And since localhost cannot call external files, i.e. outside of C:/Program Files/Apache/htdocs, due to
QUOTE
You don't have permission to access C:/1.htm on this server.

is there a clever way to access restricted files on the server from a local browser?

 

 

 


Reply

coolcat50
Hmm, I am not quite sure, but you could possibly use a Perl script or something similar. I really don't see how you can. I don't think you can do it though because of Apache's configuration of htdocs being your folder for the server to look through. I could be wrong though.

EDIT: I just thought of a possible way to temporarily put the file inside htdocs. You can use a FTP server and the FTP functions in PHP to put and get the file from a FTP server and delete them. That could work.

Reply

truefusion
QUOTE(BuffaloHELP @ Feb 6 2008, 09:49 PM) *
is there a clever way to access restricted files on the server from a local browser?

It may have to do with your PHP.ini configuration. I remember once during testing of one of my scripts where i tried to include a file outside of my DocumentRoot: it gave me access denied, saying that i could not access files outside of my DocumentRoot. Browsing the PHP.ini configuration, i noticed that the section "Paths and Directories" had include_path commented out. I uncommented that line for my operating system, included the directory i wanted access to, and restarted the Apache server. This allowed me to include a file outside of my DocumentRoot. Try this out and see if it helps.

Reply

BuffaloHELP
coolcat50,

Nice work around! Although I barely got it to work, certainly it was one of solutions.

truefusion,

Brilliant! Instead of just HTML I guess I can use PHP to include files. It worked like a charm. And now to rewrite the code tongue.gif

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. iframe "file://c:/" - 1.92 hr back.
  2. javascript file local computer - 3.21 hr back.
  3. iframe to local directory - 3.76 hr back.
  4. put my computer in a frame html - 8.51 hr back.
  5. open a local file with php web server computer - 14.82 hr back.
  6. iframe to localhost - 17.38 hr back.
  7. similar looking to iframe - 23.21 hr back.
Similar Topics

Keywords : iframe, src, local, file, computer

  1. Html Ascii Codes - A Complete List
    downloadable php file (3)
  2. Iframe Menu Question
    (1)
    I am trying to make a menu for my site. I made an HTML page with the text/links of the menu, then I
    embedded that page in all the main "content" pages using an iframe. The problem is that whenever I
    click the links in the menu they open INSIDE of the iframe instead of switching the whole browser to
    the page the link is directed to. I hope I'm not TOO hard to understand. /wink.gif"
    style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> Oh, and on this page it has
    the perfect example of what I want. http://www.w3schools.com/tags/tag_iframe.asp See ....
  3. Getting Content From A Different File
    (4)
    Hey, I think this would be simple to html programmers.. but not to me. I got a website template to
    make it easy, and there are boxes at the side that i can just put text in. But what I put in these
    boxes I want to appear on every page of the site. So by doing that i put a piece of code in telling
    it to get the text content from an external file. How would I do this? Here is the string at the
    moment. Code: CODE <TD COLSPAN=3 background="images/image_45.jpg"><div
    align="center"><font color="#FF8000" size="2" face=....
  4. Integrating One Html File Into Another
    without embedding (27)
    Hey guys I'm overhauling my website and have decided instead of using frames I want to just
    have a logo and buttons integrated into each HTML file, so you can just scroll down past it. I want
    the logo at the very top, before any content. I was wondering if there is any way of doing it with
    an HTML tag (i.e. not PHP or any other scripts) so the header just gets inserted right after the
    opening tag. I'm thinking that possibly it uses the tag, but really I don't have much of
    an idea. Thanks in advance for your suggestions. Peace out /smile.gif' border=....
  5. Xml And Asp
    Displying XML file with ASP (1)
    Hello ! I needed to display xml files rather RSS feed from different sources into an ASP file
    .. Just like Google news. Actually i have the asp script but can anyone give help me make css or
    xslt file for that xml file so that i can display news like google thanks....
  6. Making A Refresh Link On Your Website.
    refresh local webpage (16)
    /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> post it on ur website
    CODE <a href="javascript:this.location.reload();" style="color:
    #000000; font-weight: normal">refresh</a> It can refresh local webpage. U
    can add it at ur forum so that each topic u are reading can be refresh easily. If ur website
    return to homepage after pressing I.E. refresh button, then u must need this coding. /cool.gif'
    border='0' style='vertical-align:middle' alt='cool.gif' /> Beacus visitors only w....
  7. Word.doc Or Pdf Formatted File To Display In A Web
    How to maintain the formatting??? (12)
    I have a document which was originally created using ms office word processing with very strict
    formatting requirements. It is a high level academic paper which I would like to make viewable
    within a web page complete with the original formatting. I also have it available as a pdf file with
    the same formatting. Regardless of the format, is there a way to convert this highly formatted
    document into an html page and retain the formatting without major work? The only way I have been
    able to do this so far is with the use of a table layout , an iframe, and the client havi....
  8. Play Sound File Without Media Player Showing
    (3)
    Currently I have ICONS (JPGs) on a number of my pages that, when clicked, allow the user to hear a
    specific audio (WMA)file related to the page. The problem is that when the icon is clicked, the
    audio file plays, but it opens (in this case) the Windows Media Player. I am trying to avoid that
    from happening. My workaround is to create a separate, new window (small in size), that opens and
    has the sound file attached to the background of the new window, playing automatically when opened.
    This works... I can also make about 30 of these little windows for each of the 30 s....
  9. Disabling Horizontal Scroller In Iframe?
    How can I do that? (13)
    Is there a way to disable the horizontal scroller in iframes? If yes, how can I do it?....
  10. Executable Instead Of Html File
    (2)
    I have a HTML file which I use to logon to my account easily It When I open it I get a normal HTML
    page in frond of me where I can push the button to login to my webpage. Is there a possibility to
    open the HTML file and go directly into my page? Now it uses input fields like this which are
    hidden: It would be nice if someone knows how to make a sort of a executeble out of it, so I
    only have an icon on my desktop which I can use to login. This is the file in total which I use
    now: E-Mail en Agenda <script language="javascript" type="text/javascript....
  11. File Ristrictions On Xml (.wmz)
    (1)
    What lead me to this trap website is geocities would not let me upload documents I created with word
    that contained formulas. The created web pages used xml. The files they would not except where
    called xml skins and had the extension (.wmz) Anyway this will make my 10th post so hopefully I can
    put more thought into my posts now.....

    1. Looking for iframe, src, local, file, computer

Searching Video's for iframe, src, local, file, computer
advertisement



Iframe Src = A Local File In My Computer



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE