0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ブラウザーで録音、アップロード

Last updated at Posted at 2021-12-07

こちらのプログラムを参考にしました。
addpipe/simple-recorderjs-demo
recorder_dec07.png

PHP ファイルを改造して、work_dir に wav ファイルが保存されるようにしました。

フォルダー構造

$ tree
.
├── index.html
├── js
│   └── app.js
├── README.md
├── style.css
├── upload.php
└── work_dir
    └── 2021-12-07T03:01:49.170Z.wav

インストール方法

git clone https://github.com/addpipe/simple-recorderjs-demo
cd simple-recorderjs-demo
mkdir work_dir
chmod 777 work_dir

改造した PHP ファイル

upload.php
<?php
print_r($_FILES); //this will print out the received name, temp name, type, size, etc.

$size = $_FILES['audio_data']['size']; //the size in bytes
$input = $_FILES['audio_data']['tmp_name']; //temporary name that PHP gave to the uploaded file
$output = "work_dir/" . $_FILES['audio_data']['name'].".wav"; //letting the client control the filename is a rather bad idea

//move the file from temp name to local folder using $output name
move_uploaded_file($input, $output);

?>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?