ugrás a tartalomhoz

Videó feltöltési szkript javítás: attribútumok, videó típusok, méretek

chipi · 2006. Aug. 21. (H), 15.01
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. :->
  1. <?php   
  2.   
  3. session_start();  
  4.  if(isset($_SESSION["correct"])){  
  5. $username=$_SESSION["correct"];  
  6. $_SESSION["correct"]=$username;  
  7. }   
  8. else{  
  9. header("Location: index.php?sikerblog=login&hiba=feltolt");  
  10. exit;  
  11. }  
  12. // dátum  
  13. $_datum = getdate();  
  14. $mai_datum=$_datum["year"].".".$_datum["mon"].".".$_datum["mday"];  
  15. // pontos idõ  
  16. // G=24 órás idõ h=12 órás idõ A=am vagy pm kiírása  
  17. $ido=(date ("G:i:s"));  
  18. $title=$_POST["title"];  
  19. $video_megjegy=$_POST["megjegyzes"];  
  20. $video_kat=$_POST["kategoria"];  
  21. $filedir = 'video';   
  22. //Adatbázis megnyítása  
  23. include("kapcsolodas.php");  
  24.   
  25. if(isset($_FILES['userfile']))   
  26. {   
  27. //print_r($_FILES['userfile']);  
  28.  $size = $_FILES['userfile']['size'];   
  29.  $type = $_FILES['userfile']['type'];   
  30.    
  31.  if ($size < 1000000000)   
  32.  {   
  33.   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  
  34.   {   
  35.   
  36.     if(!file_exists($filedir . '/' . basename($_FILES['userfile']['name'])))  
  37.       
  38.        {  
  39. $min = 1;  
  40. $max = 99999;  
  41. $ell = rand ( $min$max );   
  42. $video_helye=$_FILES['userfile']['name'];  
  43.   
  44. $str = sprintf("Ez a string egy escape-el végzõdik: %c", 644);  
  45.   
  46.            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 &nbsp; $ido')");  
  47. print("A videót sikerült feltölteni az oldalra!\n A videót a videó linkre kattintva megtalálja.");  
  48.          if(move_uploaded_file($_FILES['userfile']['tmp_name'],$filedir . '/' .basename($_FILES['userfile']['name'])));  
  49.   
  50.   } else {   
  51.    print "<br>Ilyen nev&ucirc; videó már létezik!!";   
  52.    }  
  53.    }else{  
  54.    echo  $type = $_FILES['userfile']['type'];  
  55.     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!!";   
  56.    }   
  57.  }    
  58.  else   
  59.  {   
  60.      $size = $size*1024;   
  61.      echo "Túl nagy a file! (A te videód mérete ".$size." KB, maximum 10Mb tudsz feltölteni!)";   
  62.        
  63.  }   
  64.    
  65. }  
  66. ?>  
  67.   
  68. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
  69. <html>  
  70. <head>  
  71. <title></title>  
  72. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">  
  73. <style type="text/css">  
  74. <!--  
  75. body {  
  76.     background-image: url(bgb.gif);  
  77. }  
  78. -->  
  79. </style></head>  
  80. <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">  
  81. <form name="kepek" method="post" action="index.php?sikerblog=feltoltes" enctype="multipart/form-data"  id="kepek"  onsubmit="YY_checkform('kepek',  
  82. 'title','#q','0','Nincs név!',  
  83. 'url','#q','0','Nincs url cím!');return document.MM_returnValue">  
  84.     <table width="535" height="136" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFA8">  
  85.       <tr>  
  86.         <td width="272" height="117">&nbsp;</td>  
  87.         <td width="506"><img src="images/upload.gif" width="218" height="77"></td>  
  88.       </tr>  
  89.       <tr>  
  90.         <td>&nbsp;</td>  
  91.         <td width="506" height="40">&nbsp;</td>  
  92.       </tr>  
  93.     </table>  
  94.   
  95.   <table width="535" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFA8" height="330">  
  96.     <tr>   
  97.       <td width="97" height="21">Felt&ouml;lt&eacute;s:</td>  
  98.       <td width="269" height="21"><input type="file" name="userfile" size="30"></td>  
  99.       <td width="26" height="21">&nbsp;</td>  
  100.       <td width="143" height="21">&nbsp;</td>  
  101.     </tr>  
  102.     <tr>   
  103.       <td colspan="4" height="19" width="535">&nbsp;</td>  
  104.     </tr>  
  105.     <tr>   
  106.       <td height="21" width="97">Vide&oacute; c&iacute;me:</td>  
  107.       <td height="21" width="269"><input name="title" type="text" id="title" size="30" maxlength="30">  
  108.         <br>  
  109.         <script>  
  110. displaylimit("","title",30)  
  111.       </script> </td>  
  112.       <td height="21" width="26">&nbsp;</td>  
  113.       <td height="21" width="143">&nbsp;</td>  
  114.     </tr>  
  115.     <tr>   
  116.       <td colspan="4" height="14" width="535">&nbsp;</td>  
  117.     </tr>  
  118.     <tr>  
  119.       <td height="19" width="98">Kategoria:</td>  
  120.       <td height="19" width="269"><select name="kategoria" id="kategoria">  
  121.           <option value="">---V&aacute;lasszon k&eacute;rem-----</option>  
  122.           <option value="csalad">Csal&aacute;d (max 1perc)</option>  
  123.           <option value="egeszseg">Eg&eacute;szs&eacute;g (max 1 perc)</option>  
  124.           <option value="penz">P&eacute;nz (max 1 perc)</option>  
  125.           <option value="pax">Pax (max 1 perc)</option>  
  126.           <option value="japantapasz">Jap&aacute;ntapasz Plusz</option>  
  127.           <option value="egyeb">Egy&eacute;b (max 1 perc)</option>  
  128.           <option value="gyerekszaj">Gyereksz&aacute;j-vide&oacute;k (max 1 perc)</option>  
  129.           <option value="sikerintejuk">Sikerinterjuk (max 5 perc)</option>  
  130.           <option value="erdekvedelem">&Eacute;rdekv&eacute;delem (max 1 perc)</option>  
  131.           <option value="english">English video</option>  
  132.         </select></td>  
  133.       <td height="19" width="25">&nbsp;</td>  
  134.       <td height="19" width="143">&nbsp;</td>  
  135.     </tr>  
  136.     <tr>  
  137.       <td colspan="4" height="19" width="535">&nbsp;</td>  
  138.     </tr>  
  139.     <tr>   
  140.       <td height="55" width="97">Megjegyz&eacute;s:</td>  
  141.       <td height="55" width="269">  
  142.       <textarea name="megjegyzes" cols="23" wrap="OFF" id="megjegyzes"><?php echo $video_megjegy; ?> </textarea>  
  143.         <br>  
  144.       <script>  
  145. displaylimit("","megjegyzes",100)  
  146.       </script></td>  
  147.       <td height="55" width="26">&nbsp;</td>  
  148.       <td height="55" width="143">&nbsp;</td>  
  149.     </tr>  
  150.     <tr>   
  151.       <td colspan="4" height="19" width="535">&nbsp;</td>  
  152.     </tr>  
  153.     <tr>   
  154.       <td height="43" width="97">&nbsp;</td>  
  155.       <td height="43" width="269"><div align="center">  
  156.           <input name="submit" type="submit" value="Felt&ouml;lt&eacute;s">  
  157.         </div></td>  
  158.       <td height="43" width="26">&nbsp;</td>  
  159.       <td height="43" width="143">&nbsp;</td>  
  160.     </tr>  
  161.     <tr>   
  162.       <td height="84" colspan="4" width="535"><hr width="500"> &nbsp;</td>  
  163.     </tr>  
  164.   </table>  
  165.   <p>&nbsp;</p>  
  166. </form>  
  167.   
  168.   
  169. </body>  
  170. </html>  
 
1

post != upload

Joó Ádám · 2006. Aug. 21. (H), 16.10
Szerintem 10 megabyte a post_max_size értéke, de ez neked nem elég. Az upload_max_filesize értéke alapból 2 mega a PHP5-ben, ezt is növelni kell.
2

feltöltés

chipi · 2006. Aug. 21. (H), 16.18
És akkor ezt a szerveren kell növelni ezt az alap 2 Mb-t?
3

igen

Joó Ádám · 2006. Aug. 21. (H), 20.40
Igen, a szerveren. A php.ini beállítását kell megváltoztatni (akár a szkriptedből, az iniset() függvény segítségével).