Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php code for video upload

<?php

$allowedExts = array("jpg", "jpeg", "gif", "png", "mp3", "mp4", "wma");
$extension = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);

if ((($_FILES["file"]["type"] == "video/mp4")
|| ($_FILES["file"]["type"] == "audio/mp3")
|| ($_FILES["file"]["type"] == "audio/wma")
|| ($_FILES["file"]["type"] == "image/pjpeg")
|| ($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg"))

&& ($_FILES["file"]["size"] < 20000)
&& in_array($extension, $allowedExts))

  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
  else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "<br />";
    echo "Type: " . $_FILES["file"]["type"] . "<br />";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
    echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

    if (file_exists("upload/" . $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. ";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "upload/" . $_FILES["file"]["name"]);
      echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
      }
    }
  }
else
  {
  echo "Invalid file";
  }
?>
Comment

php code for video upload

<form method="post" enctype="multipart/form-data">
    <div><?php echo $message; ?></div>
    <?php echo $max_file_size_tag; ?>
    <input type="file" accept="video/*" ID="fileSelect" runat="server" size="20" name="filename" action="/vids/file-upload.php">
    <select name="course">
        <option value="select" selected>Select</option>
        <option value="java">Java</option>
        <option value="python">Python</option>
        <option value="vb">Visual Basic</option>
        <option value="c">C/C++</option>
        <option value="ruby">Ruby</option>
    </select>
    <input type="submit" value="Upload" name="submit">
</form>
Comment

PREVIOUS NEXT
Code Example
Php :: laravel log 
Php :: wordpress get user data from email 
Php :: laravel @extends 
Php :: laravel database seeder medium 
Php :: symfony set timezone 
Php :: php submit form in new tab 
Php :: bindparam php 
Php :: laravel Service Unavailable 
Php :: read line by line php 
Php :: how to get index 2nd php 
Php :: laravel continue 
Php :: openssl encrypt php with key 
Php :: wordpress theme development boilerplate 
Php :: concatener 2 variables php 
Php :: loop iteration laravel 
Php :: install php version 7.3 ubuntu 
Php :: laravel collection toQuery 
Php :: php showing code in browser 
Php :: APP_DEBUG is set to true while APP_ENV is not local 
Php :: How to change site url using wp-config.php 
Php :: laravel pluck example 
Php :: where with and and or in a laravel 
Php :: named route with parameter laravel 
Php :: session not working php 
Php :: merge collections laravel 
Php :: calling fucnction in an other function php 
Php :: php artisan route list does not show all my routes 
Php :: php knoww if array has duplicate values 
Php :: move_uploaded_file 
Php :: autoload file in laravel 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =