Javascript this is very limited for safety reasons.
The size I know is possible through the this.files[0].size
and the name, through this.files[0].name
used an Event Handler in jQuery. Then to format to be noticeable you can use a function like this:
function humanFileSize(bytes, si) {
var thresh = si ? 1000 : 1024;
if(bytes < thresh) return bytes + ' B';
var units = si ? ['kB','MB','GB','TB','PB','EB','ZB','YB'] : ['KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB'];
var u = -1;
do {
bytes /= thresh;
++u;
} while(bytes >= thresh);
return bytes.toFixed(1)+' '+units[u];
};
Example: http://jsfiddle.net/16jv4r89/1/
In PHP found this answer which suggests a external library getID3 which supports different formats. Having a look at the page supports the most common formats.
So in PHP it would be:
$getID3 = new getID3;
$file = $getID3->analyze($filename);
echo("Duration: ".$file['playtime_string'].
" / Dimensions: ".$file['video']['resolution_x']." wide by ".$file['video']['resolution_y']." tall".
" / Filesize: ".$file['filesize']." bytes<br />");
It would be good if you showed the method you are using to upload.
– brasofilo
At the moment I can say that there is no method, I’m just using a little PHP to grab the file and transfer the video to a folder. You want me to post php code?
– ivan veloso
Ivan in Javascript is very limited. Almost everything is forbidden/blocked for security reasons. I think you’ll have to do it via PHP, and that means "after the upload".
– Sergio
@Sergio, it may also be after the upload, but how can I extract this information from the video with php?
– ivan veloso
In this case I suggest to edit the question, join this possibility and join the PHP tag as well
– Sergio