The web page I’m testing has html5 video></video that captures/records and autoplays successfully. After Upload is selected, and some time passes, the page displays a pop-up dialog box showing “Ok” (via chrome -desktop), I am assuming that is when the file finally arrives in the uploads/ folder (via save1.php). After testing I’m beginning to think the page needs to be hard refreshed upon the the dialog box appearing, if a re-record is needed in order to have a successful upload. Can you suggest a proper code for hard refresh? Not to clear all cache, just the page. Also, where can I change the dialog box to something more informative than “Ok”, like “File has been sent”?
Much thanks again I look forward to any additional help. Here’s the current code:
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");
}
}
}