I have something that allows you to upload pictures (assuming you could do the same thing with videos)
index.php
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form action="upload_rename_ac.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" value="Submit">
</form
></body>
</html>
upload_rename_ac.php
PHP Code:
<?php
$random_digit_one=rand(0,99999999);
$random_digit_two=rand(0,99999999);
$random_digit_fin=rand(0,99999999);
$allowedExts = array("gif", "jpeg", "jpg", "png"); //Change this to video files
$temp = explode(".", $_FILES["file"]["name"]);
$extension = end($temp);
if ((($_FILES["file"]["type"] == "image/gif") /*Change file type*/
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/jpg")
|| ($_FILES["file"]["type"] == "image/pjpeg")
|| ($_FILES["file"]["type"] == "image/x-png")
|| ($_FILES["file"]["type"] == "image/png"))
&& ($_FILES["file"]["size"] < 20000000) /* change size */
&& 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\\" . $random_digit_one.'_'.$random_digit_two.'_'.$random_digit_fin.'_'.$_FILES["file"]["name"]);
echo "Stored in: " . "upload\\" . $random_digit_one.'_'.$random_digit_two.'_'.$random_digit_fin.'_'.$_FILES["file"]["name"];
// echo '<div><image src="upload\\' . $random_digit_one.'_'.$random_digit_two.'_'.$random_digit_fin.'_'.$_FILES["file"]["name"].'" width="50%" /></div>';
echo '<a href="index.php">Return</a>';
}
}
}
else
{
echo "Invalid file";
}
?>
This shall uploading it. If you wanna add something to match the name with the video type and just throw the video name with the video uploaded i think that shall work. However, its late for me so i cant really check right now.
Bookmarks