Welcome Guest, Not a member yet? Register   Sign In
file size and duration
#4

(07-23-2016, 11:26 PM)matin Wrote: how to save file size and duration of a uploaded video file.
$this->upload->data(file_size)
must work for storing file size but it doesn't work on my server, here is the error:
Use of undefined constant file_size - assumed 'file_size'

As @arma7x points out, you need to put quotes around file_size. Keep in mind that upload->data() isn't going to work until after upload->do_upload() has been called.

@site2017 presents a reasonable method to approximate the duration. If you want more accuracy here are a couple libraries that you might find interesting.

Zedwood.com PHP Calculate Duration of MP3
jagneshchawla/audio length Mp3 class- PHP

If you are looking for a library that provides additional file info and/or is useful for many different file formats beyond mp3 check out the following.

getID3()
Reply


Messages In This Thread
file size and duration - by matin - 07-23-2016, 11:26 PM
RE: file size and duration - by arma7x - 07-24-2016, 01:44 AM
RE: file size and duration - by site2017 - 12-11-2017, 11:52 PM
RE: file size and duration - by dave friend - 12-12-2017, 09:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB