php - how user can upload video to my website -


i'm working on website want user upload image or video.

<form enctype="multipart/form-data" action="upload.php" method="post">      <div id="filediv">         <input name="file[]" type="file" id="file"/>     </div>      <br/>      <input type="button" id="add_more" class="upload"  value="add more files"/>     <input type="submit" value="upload file" name="submit" id="upload" class="upload"/> </form> 

my upload.php store image value in database, in same way have store videos

uplaod.php

<?php include "dbconfig.php"; if (isset($_post['submit'])) {     $j = 0;       $name = $_files['file']['name'];      $target_path = "uploads/";       ($i = 0; $i < count($_files['file']['name']); $i++)      {          $validextensions = array("jpeg", "jpg", "png", "mp3", "mp4", "wma");           $ext = explode('.', basename($_files['file']['name'][$i]));         $file_extension = end($ext);           //print_r(basename($_files['file']['name'][$i]));         $target_path = $target_path . md5(uniqid()) . "." . $ext[count($ext) - 1];         $j = $j + 1;          if (($_files["file"]["size"][$i] < 1024*1024*1024)   && in_array($file_extension, $validextensions))          {             if (move_uploaded_file($_files['file']['tmp_name'][$i], $target_path))              {                 echo $j. ').<span id="noerror">image uploaded successfully!.</span><br/><br/>';                 $actual_image_name=$_files['file']['name'][$i];                 mysqli_query($link,"insert members(avatar) values ('$actual_image_name')");              }             else              {                 echo $j. ').<span id="error">please try again!.</span><br/><br/>';             }         }          else          {             echo $j. ').<span id="error">***invalid file size or type***</span><br/><br/>';         }     } } ?> 

this works fine uploading image not uploading videos

by default, maximum upload_limit set 2 mb. if try upload file size more 2 mb, fail.

to change it, please edit php.ini , set

upload_max_filesize = 40m ; may set according need 

Comments