Assalamu'alaikum wr wb
Kali ini saya akan share bagiamana caranya upload file video di php.
Berikut ini syntaxnya :
__________________________________________
file upload_video.php
________________
<!DOCTYPE html><head>
<title></title>
</head>
<body>
<form action="upload_file.php" method="post" enctype="multipart/form-data">
<label for="file"><span>Filename:</span></label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>
__________________________________________
file upload_file.php
______________
<?php$name=$_FILES['file']['name'];
$type=$_FILES['file']['type'];
//$size=$_FILES['uploadvideo']['size'];
$cname=str_replace(" ","_",$name);
$tmp_name=$_FILES['file']['tmp_name'];
$target_path="video/";
$target_path=$target_path.basename($cname);
if(move_uploaded_file($_FILES['file']['tmp_name'],$target_path))
{
//echo $sql="INSERT INTO tbl_video(name,type) VALUE('".$cname."','".$type."')";
//$result=mysql_query($sql);
echo "Your video ".$cname." has been successfully uploaded";
}
?>
__________________________________________
Semoga bermanfaat.
Cara upload file video
Reviewed by Syawaluddin Amin, S.Kom
on
Januari 11, 2014
Rating:
Tidak ada komentar: