Jump to content

video upload with php


atticus

Recommended Posts

I am trying to upload videos to the server with a form using php.  The address of the video is stored in mysql.  It is not functioning properly.  It works fine for images, but is not uploading the videos.

 

$uploadDir = 'upload/';

if(isset($_POST['upload']))
{

$fileName = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];

$filePath = $uploadDir . $fileName;

$result = move_uploaded_file($tmpName, $filePath);
chmod($filePath, 0755);
if (!$result) {
echo "Error uploading file";
exit;
}


if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
$filePath = addslashes($filePath);
} 
mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($db_name);

$query = "INSERT INTO upload2 (name, size, type, path, title, description, buy, sort) ".
"VALUES ('$fileName', '$fileSize', '$fileType', '$filePath', '$_POST[title]', '$_POST[description]', '$_POST[buy]', '$_POST[sort]')";

mysql_query($query) or die('Error, query failed : ' . mysql_error()); 

 

any suggestions...

Link to comment
https://forums.phpfreaks.com/topic/76548-video-upload-with-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.