Jump to content

Chrisj

Members
  • Posts

    551
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Chrisj

  1. In Chrome, and IE8, when this link is selected:

     



    <a href="../upload/[blk1.thumbnail]"><form action="../upload/[blk1.thumbnail]"><input type="image" src="../images/MI.png"></form></a>


     

    the file appears successfully.

     

    In IE10 and IE9, instead of the file appearing successfully, a dialog box appears asking "Do you want to open or save (the file name) from www...com? OPEN SAVE CANCEL

     

    In FF it says "You have chosen to open (the file name) which is application/ocet-stream from www...com OPEN SAVE CANCEL

     

    What can I add (or change) so that the file appears, upon selecting the link, in IE10, IE9 and FF? instead of a dialog box appearing?

  2. I have tried other players and am now testing the mediaelement.js player, which works in all browsers, playing the video, and shows the 'poster' image in all browsers, except no 'poster' image appears in IE8.
     
    As I know the "poster' isn't supported by IE8, I'm looking for help with a work-around to place a thumbnail image as a substitute (for IE8) for the 'poster' image. Any help will be appreciated. Here's my current code:
     
    <video id="video" poster="http://www.-domain-.com/img/testImage.jpg" preload="none" controls="controls" width="240" height="220" >
    <source type="video/mp4" src="http://www.-domain-.com/video/testVideo.mp4"/>
    <object width="240" height="220" type="application/x-shockwave-flash" data="http://www.-domain-.com/mediaelement/flashmediaelement.swf">
     <param name="movie" value="http://www.-domain-.com/mediaelement/flashmediaelement.swf"     />    
    <param name="flashvars" value="controls=true&file=http://www.-domain-.com/video/testVideo.mp4" />
    <!-- Image as a last resort -->
    <img src="http://www.-domain-.com/img/testImage.jpg" width="240" height="220" title="No video playback capabilities" />
    </object>
    </video>
    

     

  3.  I have video-js code on a web page like this:

    <video id="video2" class="video-js vjs-default-skin" controls preload="auto" width="140" height="120"
    poster="/video/countdown.jpg" data-setup="{}">
    <source src="/video/vid1.mp4" type='video/mp4' />
    </video>
    

    Do you see anything wrong with this code?

    I have that code several times on the same page. It all plays successfully in Chrome, but in IE11 while a few players play their video(self-hosted),
    I see this "The video player aborted due to corruption problem or because the video used features your browser did not support"

    And in Firefox 37.0, I see this:
    "A network error caused the video download to fail part-way".

    The code in the header is

    <link href="/video-js/video-js.css" rel="stylesheet">
    <script src="/video-js/video.js"></script>
    <script>videojs.options.flash.swf = "/video-js/video-js.swf"</script>
    

    I suspect something simple in the code is a bit off.

    Do you know the solution? I look forward to any comments/insight/solutions.

     

     

  4. I'm using the PHP script for a video web site, and have added the ability to show the user's avatar (that he adds to his User Profile) as his uploaded video's Thumbnail image, in place of the thumbnail that's generated by the uploaded video itself (if the User leaves his avatar blank, the thumbnail generated by the video will show).


    It works successfully when the videos uploaded are short and not when the videos are longer.


    When I comment-out the added code (the nine commented-out lines near the bottom of the convertor.php code -posted below), all files upload successfully and the video-generated thumbnail appears.


    When I remove the commenting-out of those lines of code, only shorter videos show the avatar thumbnail, and only shorter videos(200KB for example) upload at all. Longer videos (25,000KB for example) don't appear to have uploaded. (maybe it's a timed-out thing when that code is looking for a thumbnail?)


    Any insight or suggestion will be appreciated.



    $sql = "SELECT file_name FROM pictures WHERE user_id = $user_id LIMIT 1";
    $result = mysql_query($sql);
    $row = mysql_fetch_array($result);
    $pic_file = $row['file_name'];
    $output_file = $base_path."/uploads/thumbs/".$file_name_no_extension.'.jpg';
    $input_file = $base_path."/pictures/".$pic_file;
    echo "Input file = ".$input_file;
    echo " and Output file = ".$output_file."<br>";
    copy($input_file, $output_file);

  5. Thanks for your reply/code, however it did not work successfully.

     

    I'm using a PHP script where this Form ultimately uploads a video. It has been modified so that the user, while filling in the Form, can optional add an image file to his Form info, then upon selecting the Submit button the image is renamed and uploads the Form info and (optional) image, after Submit the next page is where the user selects a video file to upload (and the image is linked to the video). When the video is searched a link appears next to the video thumbnail image. The link is for viewing the (optional) image file. When am image file has not been uploaded via the Form, the link showed only "Access Forbidden", until the NoInfoAvailable1.png code was added (successfully)(to show something more informative than "Access Forbidden"). However, now using your new code provided in the posting, upon not uploading an image, via the Form, I now again see "Access Forbidden" instead of NoInfoAvailable1.png. Any additional help will be appreciated.

  6. Thanks for your reply.

    Can you describe what's going on here, please?:

            if(!isset($error)){
                $uploadedFile = $_FILES['file']['tmp_name'];
                $thumbnail = $_SESSION['user_id'] . '-' . $randomString . "." . $extension;
                move_uploaded_file($uploadedFile, "upload/" . $thumbnail);
            }else{
                //Make sure NoInfo image has png extension
                $thumbnail = $_SESSION['user_id'] . '-' . $randomString . ".png";
                copy("upload/NoInfoAvailable1.png", "upload/" . $thumbnail);
            }
    

    And here:

     

     

     

    if(isset($error)){echo $error;}

    Thanks

  7. Can you please explain ALL that this code does?

    if (isset($_POST['form_submitted'])):
    
        // $randomString needed regardless of passing tests so put outside error condition
        $randomString = time();
    
        if((isset($_FILES) && $_FILES['file']['error'] != 0) || !isset($_FILES)){
    
            //Unable to upload file to temp
            //Set variable for final move/copy condtion with no message
            $error = '';
    
        }else{
    
            $allowedExts = array("doc", "gif", "jpeg", "jpg", "txt", "pdf", "png", "txt");
            $temp = explode(".", $_FILES['file']['name']);
            $extension = strtolower( end($temp) );
    
            if(!in_array($extension,$allowedExts)){
    
                $error = '<div id="errorMessage">>> Error: Invalid File Name </div>';
    
            }elseif($_FILES['file']['size'] >= 100000){
    
                $error = '<div class="errorMessage1">>> Error: Image File Size Exceeds Limit</div>';
    
            }
        }
    
            if(!isset($error)){
                $uploadedFile = $_FILES['file']['tmp_name'];
                $thumbnail = $_SESSION['user_id'] . '-' . $randomString . "." . $extension;
                move_uploaded_file($uploadedFile, "upload/" . $thumbnail);
            }else{
                //Make sure NoInfo image has png extension
                $thumbnail = $_SESSION['user_id'] . '-' . $randomString . ".png";
                copy("upload/NoInfoAvailable1.png", "upload/" . $thumbnail);
            }
                $_SESSION['thumbnail'] = $thumbnail;
                $file_location = '<a href="http://www....com/upload/' . $thumbnail . '">' . $thumbnail . '</a>';
    
    endif;
    if(isset($error)){echo $error;}
    

    Thank you. I look forward to being enlightened.

     

  8. I have this code, for an Upload Form, that works successfully renaming and moving an uploaded file to the upload/ folder. 
    If an image isn't uploaded, what code can I add to put a default file where the file would have been if it were uploaded? This code is what's working currently:
     
    if ($form_submitted == 'yes') {
    $allowedExts = array("gif", "jpeg", "jpg", "txt", "rtf", "png");
    $temp = explode(".", $_FILES["file"]["name"]);
    $extension = strtolower( end($temp) );
    if (!in_array($extension,$allowedExts) && $_FILES["file"]["name"] != "" )
    {
    echo ("<div id=\"errorMessage\"> >> Error: Invalid File Name </div>");
    }
    else if ($_FILES["file"]["size"] >= 100000)
    {
    echo ("<div class=\"errorMessage1\"> >> Error: Image File Size Exceeds Limit </div>");
    }
    $length = 20;
    $randomString = (time());
    $thumbnail = $_SESSION['user_id'] . '-' . $randomString . "." . $extension;
    move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $thumbnail);
    $_SESSION['thumbnail'] = $thumbnail;
    $file_location = '<a href="http://www....com/upload/' . $thumbnail . '">' . $thumbnail . '</a>';
    }
    

    This is my attempt to "put a default file where the file would have been if it were uploaded", but my additions didn't suceed:

    if ($form_submitted == 'yes') {
      $defaultFilePath = '../upload/Default.png'; // set this.
      $allowedExts = array("gif", "jpeg", "jpg", "txt", "rtf", "png");
      $temp = explode(".", $_FILES["file"]["name"]);
      $extension = strtolower( end($temp) );
      if (!in_array($extension,$allowedExts) && $_FILES["file"]["name"] != "" )
        {
        echo ("<div id=\"errorMessage\"> >> Error: Invalid File Name </div>");
        $source = $defaultFilePath;
      }
      else if ($_FILES["file"]["size"] >= 100000)
      {
      echo ("<div class=\"errorMessage1\"> >> Error: Image File Size Exceeds Limit </div>");
        $source = $_FILES["file"]["tmp_name"];
      }
      $length = 20;
      $randomString = (time());
      $thumbnail = $_SESSION['user_id'] . '-' . $randomString . "." . $extension;
      if ($source === $defaultFilePath)
      {
      copy($source, "upload/" . $thumbnail);
      }
      else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $thumbnail);
      }
      $_SESSION['thumbnail'] = $thumbnail;
      $file_location = '<a href="http://www...com/upload/' . $thumbnail . '">' . $thumbnail . '</a>';
    }
    
    Any help with getting this to work correctly will be appreciated.

     

  9. Thanks for your reples. In reply to "otherwise the browser wouldn't know the url to retrieve the video from in order to play it"

     

    When a video, thru my website, is ready to be played, this shows in the browser:

     

    www........com/results.php?x=178&y=16

     

    So, the video url doesn't appear in the browser, the video(mp4) plays in the flowplayer that pops-up in a box over the page, but you can right-click (in Chrome) "Copy video URL", so someone could simply copy the url and play it over and over using my data transfer cost.

     

    Can a random string be added to the file name via the player, or something, so the theif doesn't have the correct path/link?

  10. In my php web site the video player appears and plays the video. In Chrome you can right click on the player screen and choose 'inspect element' etc, but another choice is 'Copy video URL'. How can I block that, or hide (or disguise/rename) video URLs?

  11. How can I style this drop-down list/box in IE, so it looks the same as how I have it in Chrome?

    (see attached images)

     

    Here's the current code:

    <form method="get" action="../search.php" name="myForm" />
    <select size="1" name="type" class="dropdown_box" />
    <option value="1">CHANNEL 1</option>
    <option value="2">CHANNEL 2</option>
    <option value="any string here">ALL CHANNELS</option>
    </select>
    <input autocomplete="off" id="keyword" name="keyword" value="Enter text" onfocus="if (this.value=='Enter text') {this.value=''; this.style.color='#696969';}" onclick="clickclear(this, 'Search [var.site_name]')" onblur="clickrecall(this,'Search [var.site_name]')" value="" />
    <input type="submit" value="VIEW"/>
    </form>
    
    /*input,select.dropdown_box {*/
    input.common-input, select.dropdown_box {
    width:100px;
    height: 40px;
    color:#cccccc;
    border:1px solid #cccccc;
    background: #ffffff;
    }
    
    input:focus,select:focus{background:#ffffff}
    

    Any help will be appreciated.

    post-20454-0-73008300-1417913886_thumb.png

    post-20454-0-14285800-1417913893_thumb.png

  12. I'm trying to add a file size limit to my upload form-code (below)

     

    Is this correct?



    if ( $_FILES["file"]["size"] < 100000


    If that's correct, do I need any additional code to make that line of code functional?

     



    $allowedExts = array("gif", "jpeg", "jpg", "pdf", "doc", "docx", "txt", "rtf", "png");
    $temp = explode(".", $_FILES["file"]["name"]);
    $extension = strtolower( end($temp) );
    if (!in_array($extension,$allowedExts))
    {
    echo ("Error - Invalid File Name");
    }
    $length = 20;
    $randomString = (time());
    $thumbnail = $_SESSION['user_id'] . '-' . $randomString . "." . $extension;
    move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $thumbnail);
    $sql = "INSERT INTO videos ( filename ) VALUES( '$thumbnail' )";
    mysql_query($sql);
    $file_location = '<a href="http://www.......com/upload/' . $thumbnail . '">' . $thumbnail . '</a>';


    Thanks. I look forward to any help.

     

  13. Thanks for that reply.

    I did go to Google Chrome > Developer Tools > Network --- refreshed --- and then selected the php page 'results1.php > Headers > Request Headers > view source     and I see this:

     

     

    GET /results1.php?x=63&y=11 HTTP/1.1

    Host: .......com
    Connection: keep-alive
    Cache-Control: max-age=0
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
    User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36
    Accept-Encoding: gzip,deflate,sdch
    Accept-Language: en-US,en;q=0.8
    Cookie: user=chrisj; pass=23c50817fd4612579a4aa31634388a2b8815e9; PHPSESSID=32d4133605a93870317c09aa3e8918
    Query String Parametersview sourceview URL encoded

     

    And I don't see the line "Header set Content-Disposition attachment" anywhere. I look forward to any additional reply/thoughts/guidance.

    thanks again

  14. Thanks for your message.

    I opened the web page where the "select "Click Here" link is" and then opened "the tab 'Network' in Google Chromes' Developer tools",

    and didn't see the line "Header set Content-Disposition attachment" anywhere.

     

    My .htaccess file looks like this:

    # By default, no module files may be accessed
    # directly from a webbrowser.
    Order deny,allow
    Deny from all
    
    # File types for which we make an exception.
    <Files ~ "\.(gif|jpg|jpeg|png|css|doc|js|php)$">
        Order allow,deny
        Allow from all
    </Files>
    
    Header set Content-Disposition attachment
    
    ErrorDocument 403 /403.php
    ErrorDocument 404 /404.php
    
    AddType application/x-httpd-php .html .htm
    

    Any additional help will be appreciated.

  15. Thanks for your reply.

    If I read your reply correctly, this is what I tried, I added this line "Header set Content-Disposition attachment" into a .htaccess file, and then added the .htaccess file to the /upload/ folder, then uploaded a .doc file, but it still downloaded.

    If I didn't do that correctly please let me know what to do. If I did that correctly, any other ideas will be appreciated.

  16. This upload form code works successfully, where a file is chosen, renamed and stored in the 'upload' folder,
    and when I select the "Click Here" link from a web page, it shows what was uploaded, successfully.
     
    But when I added the extension "doc" and selected "Click Here", instead of showing the document, 
    the file automatically shows that it's downloading to my computer. Can you tell me possibly why is that happening?
     
    $allowedExts = array("gif", "jpeg", "jpg", "pdf", "doc", "png");
    $temp = explode(".", $_FILES["file"]["name"]);
    $extension = strtolower( end($temp) );
    if (!in_array($extension,$allowedExts))
    {
    echo ("Error - Invalid File Name");
    exit();  
    }
    $length = 20;
    $randomString = (time());
    $thumbnail = $randomString . "." . $extension;
    move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $thumbnail);
    $sql = "INSERT INTO videos ( filename ) VALUES( '$thumbnail' )";
    mysql_query($sql);
    $file_location = '<a href="http://www....com/upload/' . $thumbnail . '">' . $thumbnail . '</a>';
    

     

  17. In the PHP script I'm using, in the Upload Form the user selects an image to Upload, the Form renames it like so:

    $allowedExts = array("gif", "jpeg", "jpg", "pdf", "png");
    $temp = explode(".", $_FILES["file"]["name"]);
    $extension = strtolower( end($temp) );
    
    if (!in_array($extension,$allowedExts))
    {
    echo ("Error - Invalid File Name");
    
    }
    $length = 20;
    $randomString = (time());
    $thumbnail = $randomString . "." . $extension;
    
    

    The random string works successfully, but I'd like to add the user_id to the beginning of it and a dash, like this:

    user_id - 

    So, the new file name would be something like:   user_id-randomString.extension

     

    Can you please help me add that?

     

  18. Thanks for your reply, but I'm not sure if providing the source is going to help here. It isn't my script I'm just trying to tweak it, to get this one function working.

     

    But, what I actually think might help, please, is to know if I add in a function, into the code above, like this example:

     function getFilename($id) {
     $sql1 ="SELECT filename FROM videos WHERE indexer = '".$id."'";
     $query1 = mysql_query($sql1) or DIE(mysql_error());
     $result = mysql_fetch_array($query1);
    
     return $result['filename'];
    
    }
    

    Will it correspond with this upload Form code - where the image file is chosen and stored:

    $allowedExts = array("gif", "jpeg", "jpg", "pdf", "png");
    $temp = explode(".", $_FILES["file"]["name"]);
    $extension = strtolower( end($temp) );
    if (!in_array($extension,$allowedExts))
    {
    echo ("Error - Invalid File Name");
    }
    $length = 20;
    $newfilename = $_SESSION['user_id'].$_FILES["file"]["name"];
    $thumbnail = $newfilename;
    move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $thumbnail);
    
    $sql = "INSERT INTO videos ( filename ) VALUES( '$thumbnail' )";
    
    mysql_query($sql);
    $file_location = '<a href="http://www.--.com/upload/' . $thumbnail . '">' . $thumbnail . '</a>';
    

    Any additional help will be greatly appreciated.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.