RQ: Скрипт за качване на видео от компютър

roskata

Registered
Здравейте, много спешно ми трябва такъв скрипт. Нещо елементарно без дизайн... Да има upload форма за качване(.flv), и да се възпроизвеждат клиповете от някой флаш плеър. Мерси. :)
 
този можеш да преработиш много лесно :

http://web-tourist.net/login/login/view.php?st=3444

и е сигурен

относно прегледа :

http://web-tourist.net/login/login/view.php?st=703

взимаш за извеждането скрипта и му слагаш някакъв FLV player ...
 
Така се качва:
PHP:
<?php
if(isset($_POST['submit'])){
include "../inc.php";
$id = (int)$_GET['id'];
$ip = $_SERVER['REMOTE_ADDR'];
$direct = $_POST['direct'];
$file=$_FILES['file']['name'];
$tmp_file=$_FILES['file']['tmp_name'];
$size=$_FILES['file']['size'];
$upload_path="".$direct."".basename($file);
$date = date('d-m-y g:i'); 
if(empty($file)) {
echo "Моля изберете файл!";
echo '</td>
<td class="c_right"><img src="../images/blank.gif" width="2" height="2" alt="" border="0"></td>
</tr>
<tr>
<td class="d_left"><img src="../images/blank.gif" width="1" height="1" alt="" border="0"></td>
<td class="d_center"><img src="../images/blank.gif" width="1" height="1" alt="" border="0"></td>
<td class="d_right"><img src="../images/blank.gif" width="1" height="1" alt="" border="0"></td>
</tr>
</table>';
require("style2.php");
exit;
}

if(file_exists($upload_path)){
echo "Файлът вече съществува!";
echo '</td>
<td class="c_right"><img src="../images/blank.gif" width="2" height="2" alt="" border="0"></td>
</tr>
<tr>
<td class="d_left"><img src="../images/blank.gif" width="1" height="1" alt="" border="0"></td>
<td class="d_center"><img src="../images/blank.gif" width="1" height="1" alt="" border="0"></td>
<td class="d_right"><img src="../images/blank.gif" width="1" height="1" alt="" border="0"></td>
</tr>
</table>';
require("style2.php");
exit;
}

if($size==0){
echo "Файлът е повреден!";
echo '</td>
<td class="c_right"><img src="../images/blank.gif" width="2" height="2" alt="" border="0"></td>
</tr>
<tr>
<td class="d_left"><img src="../images/blank.gif" width="1" height="1" alt="" border="0"></td>
<td class="d_center"><img src="../images/blank.gif" width="1" height="1" alt="" border="0"></td>
<td class="d_right"><img src="../images/blank.gif" width="1" height="1" alt="" border="0"></td>
</tr>
</table>';
require("style2.php");
exit;
}

 function random_string($max = 20000){
  $chars = explode(" ", 'a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9');
  for($i = 0; $i < $max; $i++){
   $rand_key = array_rand($chars);
   $screen1  .= $chars[$rand_key];
  }
  return str_shuffle($screen1);
 }

if($size>52428800000){
echo "Файлът е прекалено голям!";
echo '</td>
<td class="c_right"><img src="../images/blank.gif" width="2" height="2" alt="" border="0"></td>
</tr>
<tr>
<td class="d_left"><img src="../images/blank.gif" width="1" height="1" alt="" border="0"></td>
<td class="d_center"><img src="../images/blank.gif" width="1" height="1" alt="" border="0"></td>
<td class="d_right"><img src="../images/blank.gif" width="1" height="1" alt="" border="0"></td>
</tr>
</table>';
require("style2.php");
exit;
}

$extensions = array("flv","FLV");
$extension_file = end(explode(".",$file));
$extension_file = strtolower($extension_file);
if(!in_array($extension_file,$extensions)){
echo "Забранен формат!";
echo '</td>
<td class="c_right"><img src="../images/blank.gif" width="2" height="2" alt="" border="0"></td>
</tr>
<tr>
<td class="d_left"><img src="../images/blank.gif" width="1" height="1" alt="" border="0"></td>
<td class="d_center"><img src="../images/blank.gif" width="1" height="1" alt="" border="0"></td>
<td class="d_right"><img src="../images/blank.gif" width="1" height="1" alt="" border="0"></td>
</tr>
</table>';
require("style2.php");
exit;
}

$upload=move_uploaded_file($tmp_file,$upload_path);
if($upload){
$q=mysql_query("INSERT INTO `table` (`id`,`file`,`direct`,`ip`,`size`,`date`) VALUES ('$id','$file','$direct','$ip','$size','$date')");
if($q = TRUE){
echo "<font color=\"green\">Файлът е успешно качен!
<meta http-equiv='refresh' content='1;url=http://www.fighter-bg.com/admin/sitemap_album.php'/>
</font>";
}else{
echo "<font color=\"red\">Грешка!</font></center>";
exit;
}
}
}else{
?>
<form action="" method="post" enctype="multipart/form-data" class="upform" name="upload" id="upload">

<table width="95%" border="0">
<tr><td>Файл:</td><td><input name="file" type="file">
<br><font color="green">Избери файл за качване</font></td></tr>
<input type="hidden" name="direct" value='../folder/'>
<tr><td></td><td><input name="submit" type="submit" value="Качи!"></td></tr>
</table>
</form>
<?php
}
?>

Така се пуска от плеъра:
HTML:
<script type="text/javascript" src="/jwplayer/jwplayer.js"></script>
<script type="text/javascript">jwplayer.key="ABCDEFGHIJKLMOPQ";</script>

<div id="myElement">Loading the player...</div>

<script type="text/javascript">
    jwplayer("myElement").setup({
        file: "/uploads/myVideo.mp4",
        image: "/uploads/myPoster.jpg"
    });
</script>

От тук може да изтеглиш плеъра:
http://www.longtailvideo.com/jw-player/download/
 
Благодаря за скриптовете, но ще ми е проблем да ги върва към флаш плеъра. :( Ако удариш едно рамо, ще съм много благодарен. :)
 
up на темата, понеже още не мога да го оправя... нещо подобно ми трябва. Да си добавиш описание, име на клипа и да ти излиза в малка картинка:
33333333f.png
 

Back
Горе