Videó feltöltési szkript javítás: attribútumok, videó típusok, méretek
Sziasztok!
Lenne 1-2 nagyobb gondom a spriptel:
Az első gondom az, hogy amikor feltöltök egy videót akkor az attributuma legyen 644, de ezt nem tudom, hogy hogyan kell beleírni a scriptbe.
A másik az, hogy a videó típisokkal gondok vannak, valamelyik nem megy valamelyik meg megy.
Aztán, elvielg 10Mb tudok tölteni fel, de 2 Mb nagyobbat nem enged feltölteni.
Előre is nagyon szépen köszönöm a segítséget, sűrgös lenne ez mert leszedik a fejemet érte. :->
■ Lenne 1-2 nagyobb gondom a spriptel:
Az első gondom az, hogy amikor feltöltök egy videót akkor az attributuma legyen 644, de ezt nem tudom, hogy hogyan kell beleírni a scriptbe.
A másik az, hogy a videó típisokkal gondok vannak, valamelyik nem megy valamelyik meg megy.
Aztán, elvielg 10Mb tudok tölteni fel, de 2 Mb nagyobbat nem enged feltölteni.
Előre is nagyon szépen köszönöm a segítséget, sűrgös lenne ez mert leszedik a fejemet érte. :->
- <?php
- session_start();
- if(isset($_SESSION["correct"])){
- $username=$_SESSION["correct"];
- $_SESSION["correct"]=$username;
- }
- else{
- header("Location: index.php?sikerblog=login&hiba=feltolt");
- exit;
- }
- // dátum
- $_datum = getdate();
- $mai_datum=$_datum["year"].".".$_datum["mon"].".".$_datum["mday"];
- // pontos idõ
- // G=24 órás idõ h=12 órás idõ A=am vagy pm kiírása
- $ido=(date ("G:i:s"));
- $title=$_POST["title"];
- $video_megjegy=$_POST["megjegyzes"];
- $video_kat=$_POST["kategoria"];
- $filedir = 'video';
- //Adatbázis megnyítása
- include("kapcsolodas.php");
- if(isset($_FILES['userfile']))
- {
- //print_r($_FILES['userfile']);
- $size = $_FILES['userfile']['size'];
- $type = $_FILES['userfile']['type'];
- if ($size < 1000000000)
- {
- if (($type == "video/x-ms-wmv") or ($type == "video/x-mpeg") or ($type == "video/x-divx") or ($type == "video/x-mov") or ($type == "video/x-avi") or ($type == "application/octet-stream")) //típus ismeret
- {
- if(!file_exists($filedir . '/' . basename($_FILES['userfile']['name'])))
- {
- $min = 1;
- $max = 99999;
- $ell = rand ( $min, $max );
- $video_helye=$_FILES['userfile']['name'];
- $str = sprintf("Ez a string egy escape-el végzõdik: %c", 644);
- mysql_query("INSERT INTO videofeltoltes(video,kategoria,megjegyzes,felhasznalo,ell,nev,datum) VALUES ('video/$video_helye', '$video_kat', '$video_megjegy', '$username', '$ell', '$title', '$mai_datum $ido')");
- print("A videót sikerült feltölteni az oldalra!\n A videót a videó linkre kattintva megtalálja.");
- if(move_uploaded_file($_FILES['userfile']['tmp_name'],$filedir . '/' .basename($_FILES['userfile']['name'])));
- } else {
- print "<br>Ilyen nevû videó már létezik!!";
- }
- }else{
- echo $type = $_FILES['userfile']['type'];
- echo "<br>Amit fel szeretnél tölteni nem egyezik meg egyik formátummal sem! Csak avi vagy divx vagy wmv vagy mov állományú videót tölthetsz fel!!";
- }
- }
- else
- {
- $size = $size*1024;
- echo "Túl nagy a file! (A te videód mérete ".$size." KB, maximum 10Mb tudsz feltölteni!)";
- }
- }
- ?>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <title></title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <style type="text/css">
- <!--
- body {
- background-image: url(bgb.gif);
- }
- -->
- </style></head>
- <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
- <form name="kepek" method="post" action="index.php?sikerblog=feltoltes" enctype="multipart/form-data" id="kepek" onsubmit="YY_checkform('kepek',
- 'title','#q','0','Nincs név!',
- 'url','#q','0','Nincs url cím!');return document.MM_returnValue">
- <table width="535" height="136" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFA8">
- <tr>
- <td width="272" height="117"> </td>
- <td width="506"><img src="images/upload.gif" width="218" height="77"></td>
- </tr>
- <tr>
- <td> </td>
- <td width="506" height="40"> </td>
- </tr>
- </table>
- <table width="535" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFA8" height="330">
- <tr>
- <td width="97" height="21">Feltöltés:</td>
- <td width="269" height="21"><input type="file" name="userfile" size="30"></td>
- <td width="26" height="21"> </td>
- <td width="143" height="21"> </td>
- </tr>
- <tr>
- <td colspan="4" height="19" width="535"> </td>
- </tr>
- <tr>
- <td height="21" width="97">Videó címe:</td>
- <td height="21" width="269"><input name="title" type="text" id="title" size="30" maxlength="30">
- <br>
- <script>
- displaylimit("","title",30)
- </script> </td>
- <td height="21" width="26"> </td>
- <td height="21" width="143"> </td>
- </tr>
- <tr>
- <td colspan="4" height="14" width="535"> </td>
- </tr>
- <tr>
- <td height="19" width="98">Kategoria:</td>
- <td height="19" width="269"><select name="kategoria" id="kategoria">
- <option value="">---Válasszon kérem-----</option>
- <option value="csalad">Család (max 1perc)</option>
- <option value="egeszseg">Egészség (max 1 perc)</option>
- <option value="penz">Pénz (max 1 perc)</option>
- <option value="pax">Pax (max 1 perc)</option>
- <option value="japantapasz">Japántapasz Plusz</option>
- <option value="egyeb">Egyéb (max 1 perc)</option>
- <option value="gyerekszaj">Gyerekszáj-videók (max 1 perc)</option>
- <option value="sikerintejuk">Sikerinterjuk (max 5 perc)</option>
- <option value="erdekvedelem">Érdekvédelem (max 1 perc)</option>
- <option value="english">English video</option>
- </select></td>
- <td height="19" width="25"> </td>
- <td height="19" width="143"> </td>
- </tr>
- <tr>
- <td colspan="4" height="19" width="535"> </td>
- </tr>
- <tr>
- <td height="55" width="97">Megjegyzés:</td>
- <td height="55" width="269">
- <textarea name="megjegyzes" cols="23" wrap="OFF" id="megjegyzes"><?php echo $video_megjegy; ?> </textarea>
- <br>
- <script>
- displaylimit("","megjegyzes",100)
- </script></td>
- <td height="55" width="26"> </td>
- <td height="55" width="143"> </td>
- </tr>
- <tr>
- <td colspan="4" height="19" width="535"> </td>
- </tr>
- <tr>
- <td height="43" width="97"> </td>
- <td height="43" width="269"><div align="center">
- <input name="submit" type="submit" value="Feltöltés">
- </div></td>
- <td height="43" width="26"> </td>
- <td height="43" width="143"> </td>
- </tr>
- <tr>
- <td height="84" colspan="4" width="535"><hr width="500"> </td>
- </tr>
- </table>
- <p> </p>
- </form>
- </body>
- </html>
post != upload
feltöltés
igen