php upload video file code example
Example 1: how to upload large video file in php
<!DOCTYYPE html>
<html>
<head>
<title>Chunking Upload Demo</title>
<script src="vendor/moxiecode/plupload/js/plupload.full.min.js"></script>
<script>
window.addEventListener("load", function () {
var path = "vendor/moxiecode/plupload/js/`";
var uploader = new plupload.Uploader({
runtimes: 'html5,flash,silverlight,html4',
flash_swf_url: path + 'Moxie.swf',
silverlight_xap_url: path + '/Moxie.xap',
browse_button: 'pickfiles',
container: document.getElementById('container'),
url: '2b-upload.php',
chunk_size: '200kb',
max_retries: 2,
filters: {
max_file_size: '10mb',
mime_types: [{title: "Image files", extensions: "jpg,gif,png"}]
},
init: {
PostInit: function () {
document.getElementById('filelist').innerHTML = '';
},
FilesAdded: function (up, files) {
plupload.each(files, function (file) {
document.getElementById('filelist').innerHTML += '<div id="' + file.id + '">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b></div>';
});
uploader.start();
},
UploadProgress: function (up, file) {
document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
},
Error: function (up, err) {
console.log(err);
}
}
});
uploader.init();
});
</script>
</head>
<body>
<div id="container">
<span id="pickfiles">[Upload files]</span>
</div>
<div id="filelist">Your browser doesn't have Flash, Silverlight or HTML5 support.</div>
</body>
</html>
Example 2: how to upload large video file in php
<?php
ini_set('upload_max_filesize', '50M');
ini_set('post_max_size', '50M');
ini_set('max_input_time', 300);
ini_set('max_execution_time', 300);
$source = $_FILES["file-upload"]["tmp_name"];
$destination = $_FILES["file-upload"]["name"];
move_uploaded_file($source, $destination);
?>