HTML5 HTML Media Capture
W3C Standard: Media Capture
<input type="file" accept="image/*" id="capture" capture="camera">
<p>Capture Audio:
<p>Capture Audio:
<input type="file" accept="audio/*" id="capture" capture="microphone">
<p>Capture Video:
<p>Capture Video:
<input type="file" accept="video/*" id="capture" capture="camcorder">
The below is the example code
Note: create upload folder to save the files in the upload directory
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<?php
if(!empty($_FILES)){
$target = "upload/".$_FILES['file_up']['name'];
move_uploaded_file($_FILES['file_up']['tmp_name'], $target);
}?>
<form method="POST" action="" enctype="multipart/form-data">
<input type="file" name="file_up" accept="image/*" capture="camera"/>
<button type="submit">Upload</button>
</form>
<?php if(isset($target)){?>
<img src="<?=$target?>" width="200px" height="200px"/>
<?php }?>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<?php
if(!empty($_FILES)){
$target = "upload/".$_FILES['file_up']['name'];
move_uploaded_file($_FILES['file_up']['tmp_name'], $target);
}?>
<form method="POST" action="" enctype="multipart/form-data">
<input type="file" name="file_up" accept="image/*" capture="camera"/>
<button type="submit">Upload</button>
</form>
<?php if(isset($target)){?>
<img src="<?=$target?>" width="200px" height="200px"/>
<?php }?>
</body>
</html>
0 comments:
Post a Comment