Jump to content

Hi, quick question.


spires

Recommended Posts

Hi to one and all.

I have just built a upload video file, which uploads avi, mpeg and mov files.

Does any one know of any code that will allow me to embedd the video and play on any browser (with all different plug-ins)???


Thanks for any help

here is my uploading code.
[code]
                  <?php
                 
                 
        if(strcmp($_FILES['userfile']['name'], "")) {
$random_digit=rand(00000000,99999999);

    $filedir = 'pages/vid/'; // the directory for the video

    $maxfile = '4000000'; // max file size
    $mode = octdec('0666'); // octdec -- Octal to decimal.
// The mode parameter consists of three octal number components specifying access restrictions for the owner,
// the user group in which the owner is in, and to everybody else in this order. e.g (666)
     
    $userfile_name1 = $_FILES['userfile']['name'];
    echo "$userfile_name1 name <BR><BR>";
    $userfile_tmp1 = $_FILES['userfile']['tmp_name'];
    $userfile_size1 = $_FILES['userfile']['size'];
    $userfile_type1 = $_FILES['userfile']['type'];
    echo "$userfile_type1 type <BR><BR>";
     
$type = 0;
if(strcmp($userfile_type1, "video/x-msvideo")==0){
$new_img_name1 = $id.$random_digit.".avi";
$type = 1;
}
if(strcmp($userfile_type1, "video/mpeg")==0){
$new_img_name1 = $id.$random_digit.".mpg";
$type = 2;
}
if(strcmp($userfile_type1, "video/mov")==0){
$new_img_name1 = $id.$random_digit.".mov";
$type = 3;
}
if($type == 0){
echo "Error: wrong file type.  You can upload .avi, .mpg and .mov files only.";
exit;
}

// $prod_img = the image folder and the image and name
        $prod_img = $filedir.$new_img_name1;

//move_uploaded_file -- Moves an uploaded file to a new location.
//move the uploaded file to the image folder with a tempory name.
        if(move_uploaded_file($userfile_tmp1, $prod_img)){
        $uploaded = "Video Uploaded<br>";
        }
        else{
          $uploaded = "Upload Failed<br>";
        }
// chmod -- Changes file mode,
// set the user interface for the image
        chmod ($prod_img, $mode);
       
        echo $uploaded;
       
        $title = mysql_real_escape_string(trim($_POST['title']));
        $display_name = mysql_real_escape_string(trim($_POST['name']));
        $text_title = mysql_real_escape_string(trim($_POST['text_title']));
        $text = mysql_real_escape_string(trim($_POST['text']));
       
        $insert = "INSERT INTO video_page (user_id";
       
        $values = "VALUES (".$user_id;
       
        if(strcmp($title, "") != 0){
        $insert .= ", title";
        $values .= ", '".$title."'";
        }
       
        $insert .= ", video_name";
        $values .= ", '".$new_img_name1."'";
       
        if(strcmp($display_name, "") != 0){
        $insert .= ", display_name";
        $values .= ", '".$display_name."'";
        }
        if(strcmp($text_title, "") != 0){
        $insert .= ", text_title";
        $values .= ", '".$text_title."'";
        }
        if(strcmp($text, "") != 0){
        $insert .= ", text";
        $values .= ", '".$text."'";
        }
       
        $insert .= ", display) ";
        $values .= ", 'Hide Box');";
       
        $insert .= $values;
       
        //echo $insert;
       
        $uselessrs = mysql_query($insert) or die("problem uploaded details to database.  Please contact webmaster. ".mysql_error());
                 
    }
    else{
    echo "No file selected";
    }       
                 
                 
                  ?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/28746-hi-quick-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.