I am still testing a web page where a video is recorded/captured and autoplayed successfully, however, upon Upload the file does not arrive to the server folder.
Here's the php:
I read about adding this:
But, I don't know how/where to add that. Maybe another suggestion?
Any guidance to help me determine why the uploaded file does not arrive, is appreciated
Here's the php:
PHP:
<?php
foreach (array('video', 'audio') as $type) {
if (isset($_FILES["${type}-blob"])) {
$fileName = $_POST["${type}-filename"];
$uploadDirectory = 'uploads/' . $fileName;
// make sure that one can upload only allowed audio/video files
$allowed = array(
'webm',
'wav',
'mp4',
'mov'
);
$extension = pathinfo($uploadDirectory, PATHINFO_EXTENSION);
if (!$extension || empty($extension) || !in_array($extension, $allowed)) {
echo 'Invalid file extension: '.$extension;
return;
}
$new_filepath = "uploads/" . uniqid() . ".". $extension;
if (!move_uploaded_file($_FILES["${type}-blob"]["tmp_name"], $new_filepath)) {
echo (" problem moving uploaded file");
}
}
}
?>
I read about adding this:
PHP:
file_put_contents('log.txt',print_r($_FILES,true),FILE_APPEND);
But, I don't know how/where to add that. Maybe another suggestion?
Any guidance to help me determine why the uploaded file does not arrive, is appreciated