Get Duration of Audio file when Upload

Discuss coding issues, and scripts related to PHP and MySQL.
Marius
Posts: 107

Get Duration of Audio file when Upload

Hello,
I have a form to upload audio files on server. The name of the file, path and size is stored into a table in database.
The script is working, I can get the size of the uploaded file with: $_FILES['field_name']['size']. But, how can I get the duration of the audio file (MP3 and OGG)?
I want to store in database the duration in seconds.
Thanks.

Admin
Hy,
You can get the duration of an audio /video file with JavaScript. Then, with JS you can add the duration into an input field in the form for upload.
See the code and explanations from this page: https://coursesweb.net/javascript/durati ... -upload_cs

Similar Topics