1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How do you call a file in your computer on a private webpage?

Discussion in 'Programming' started by Poon Poi Ming, May 13, 2014.

  1. #1
    Hi, I am wondering how to use the format, file:///c:/path/to/the%20file.txt, for a video named "Mood Disorder Spectrum" in my subfolder, "health", in my D drive. I tried file:///d:/health/Mood%20Disorder%20Spectrum.flv but it didn't work.
     
    Poon Poi Ming, May 13, 2014 IP
  2. neroux

    neroux Active Member

    Messages:
    566
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    60
    #2
    That would be the right syntax. What didnt work?
     
    neroux, May 13, 2014 IP
  3. Poon Poi Ming

    Poon Poi Ming Active Member

    Messages:
    163
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Hi Neroux, it doesn't appear as a clickable link on my webpage.
     
    Poon Poi Ming, May 13, 2014 IP
  4. neroux

    neroux Active Member

    Messages:
    566
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    60
    #4
    Well, how did you add it to your webpage? And secondly, it would be of little use on your webpage for anyone else besides you as they - naturally - could not access it.
     
    neroux, May 13, 2014 IP
  5. Poon Poi Ming

    Poon Poi Ming Active Member

    Messages:
    163
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #5
    I wrote it as:

    <html>file:///d:/health/Mood%20Disorder%20Spectrum.flv</html>

    Yes, you are right. As I mentioned in my first post, it is a private page. It is a website for me to write my diary and to access some of the files in my computer easily.
     
    Poon Poi Ming, May 13, 2014 IP
  6. neroux

    neroux Active Member

    Messages:
    566
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    60
    #6
    neroux, May 13, 2014 IP
  7. shmekerosu

    shmekerosu Active Member

    Messages:
    571
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    90
    #7
    Even it is a local file and look to include it in a HTML document you will need to embed it in a <a> tag, see one example below:

    
    <html>
    <body>
    <a href="file:///d:/health/Mood%20Disorder%20Spectrum.flv"> Local File Click here! </a>
    </body>
    </html>
    
    Code (markup):
    let me know if that helps.

    Cheers,
    Radu
     
    shmekerosu, May 13, 2014 IP
  8. Poon Poi Ming

    Poon Poi Ming Active Member

    Messages:
    163
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #8
    Hi Radu, it works perfectly for text files and should be good enough for me. Problem is that if it is a video file, it makes another copy of that file, each time I click the link, so if the file is a video, it may consume a lot of my hard disk space. Under the circumstances, is there a possibility of embedding the video file with a client software?
     
    Poon Poi Ming, May 13, 2014 IP
  9. neroux

    neroux Active Member

    Messages:
    566
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    60
    #9
    The previously posted link should actually answer these questions.
     
    neroux, May 13, 2014 IP
  10. shmekerosu

    shmekerosu Active Member

    Messages:
    571
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    90
    #10
    This changes the situation completely :)

    Browsers can not handle FLV by default and either you need to install some plugins or you will need to create the HTML with an online Player linked to the file.

    This can be easily achieved via:

    <head>
        <link href="http://vjs.zencdn.net/c/video-js.css" rel="stylesheet">
        <script src="http://vjs.zencdn.net/c/video.js"></script>
    </head>
    <body>
        <video id="video1" class="video-js vjs-default-skin" width="640" height="480"
            data-setup='{"controls" : true, "autoplay" : true, "preload" : "auto"}'>
            <source src="file:///d:/health/Mood%20Disorder%20Spectrum.flv" type="video/x-flv">
        </video>
    </body>
    Code (markup):
    Change the <source src='.....'> with desired link to file URI and make sure the JS script and CSS are properly accessible.

    If this does not work (I tested it ok) you can check how easy is to implement https://flowplayer.org/

    Good luck and let us know about the results,
    S.
     
    Last edited: May 13, 2014
    shmekerosu, May 13, 2014 IP
  11. Poon Poi Ming

    Poon Poi Ming Active Member

    Messages:
    163
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #11
    Almost there! The video box displayed properly but couldn't run. I am using the Mediawiki software, so I have to put the head section in a separate skin file. I wrote:

    <head>
    .....
    if($this->data['userjsprev']) { ?>
    <script type="<?php $this->text('jsmimetype') ?>"><?php $this->html('userjsprev') ?></script>
    <?php }
    if($this->data['trackbackhtml']) print $this->data['trackbackhtml']; ?>

    <link href="http://vjs.zencdn.net/c/video-js.css" rel="stylesheet">
    <script src="http://vjs.zencdn.net/c/video.js"></script>

    </head>

    I guess I ought to use $this->data, right?
     
    Poon Poi Ming, May 13, 2014 IP
  12. shmekerosu

    shmekerosu Active Member

    Messages:
    571
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    90
    #12
    How does the final generated HTML file (html source) ?
     
    shmekerosu, May 14, 2014 IP
  13. Poon Poi Ming

    Poon Poi Ming Active Member

    Messages:
    163
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #13
    Hi Shmekerosu, there is no HTML file. The HTML codes are placed inside the PHP file. Anything that is PHP is written within the codes: <?php and ?> Anything outside these codes are interpreted as HTML.
     
    Last edited: May 14, 2014
    Poon Poi Ming, May 14, 2014 IP
  14. shmekerosu

    shmekerosu Active Member

    Messages:
    571
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    90
    #14
    I know ;) What I am asking is to see the final rendered HTML code that gets displayed (after PHP is parsed). If you go to the page where the video frame is shown (but not content) just go to display page source from browser and show us the result...
     
    shmekerosu, May 15, 2014 IP
  15. Poon Poi Ming

    Poon Poi Ming Active Member

    Messages:
    163
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #15
    Hi Shmekorosu, sorry I misunderstood what you was requesting. I put the file over here, so that everything is viewable:

    http://health.jbdirectory.com/Testing
     
    Poon Poi Ming, May 15, 2014 IP
  16. shmekerosu

    shmekerosu Active Member

    Messages:
    571
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    90
    #16
    I debugged on your page and there is a clear JS error:

    "Failed to load resource: the server responded with a status of 404 (Not Found) "

    Now, if you plan to put the page online you should also upload the FLV files so that they are accessible to the public via the online player.
    Otherwise for testing purposes just put the .FLV file in the same path as HTML/PHP file and use code:

     <video id="video1" class="video-js vjs-default-skin" width="640" height="480"
            data-setup='{"controls" : true, "autoplay" : true, "preload" : "auto"}'>
            <source src="replace with your file name.flv" type="video/x-flv">
        </video>
    Code (markup):
    Let me know if this works...

    Cheers.
     
    shmekerosu, May 16, 2014 IP
  17. Poon Poi Ming

    Poon Poi Ming Active Member

    Messages:
    163
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #17
    Hi shmekerosu, this was exactly what I did. I think the problem lies with the following codes in my skin.php file:

    <link href="http://vjs.zencdn.net/c/video-js.css" rel="stylesheet">
    <script src="http://vjs.zencdn.net/c/video.js"></script>
     
    Poon Poi Ming, May 16, 2014 IP
  18. shmekerosu

    shmekerosu Active Member

    Messages:
    571
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    90
    #18
    I actually see 2 problems in final page source:

    You have:
    <p>
    <video id="video1" class="video-js vjs-default-skin" width="480" height="360"
            data-setup='{"controls" : true, "autoplay" : true, "preload" : "auto"}'>
            <source src="file:///C:/Users/Poon/Desktop/What Is a Mood Disorder.flv" type="video/x-flv">
    
    </p>
    Code (markup):
    1. there is no </video> closing tag, that is required by the script (see previous code sample)
    2. the source src = should be

    <source src="C:/Users/Poon/Desktop/What Is a Mood Disorder.flv" type="video/x-flv"> for local file
    or
    <source src="What Is a Mood Disorder.flv" type="video/x-flv"> for online file if placed in the same directory (where the php/html is executed)

    Let me know if that turns out fine.

    BR
     
    shmekerosu, May 16, 2014 IP
  19. Poon Poi Ming

    Poon Poi Ming Active Member

    Messages:
    163
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #19
    Hi shmekerosu, I wrote:

    <html>
    <video id="video1" class="video-js vjs-default-skin" width="480" height="360"
    data-setup='{"controls" : true, "autoplay" : true, "preload" : "auto"}'>
    <source src="file:///C:/Users/Poon/Desktop/mooddisorder.flv" type="video/x-flv">
    </html>

    I changed the video file name to one word, just in case the spacing is causing the error but it didn't work either. I believe the error is due to this part because MediaWiki requires some modification:

    <link href="http://vjs.zencdn.net/c/video-js.css" rel="stylesheet">
    <script src="http://vjs.zencdn.net/c/video.js"></script>
     
    Poon Poi Ming, May 16, 2014 IP
  20. Poon Poi Ming

    Poon Poi Ming Active Member

    Messages:
    163
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #20
    Poon Poi Ming, May 16, 2014 IP