Hi,
1) I have a website that will enable a user to upload a video. So far, in my test environment, I've used move_uploaded_file function, but I want to be able to restrict the extensions, only wmv and mov (or any other types later).
Is there a best way to upload a video and check if it's really a video file?
2) I've browsed around this forum and found a topic about ffmpeg, but unfortunately there are no further explanations. All I know that we use ffmpeg so that the video link will display a screenshot automatically on the website. How to this?
Thanks!
upload video and ffmpeg
Moderator: General Moderators
- thomas777neo
- Forum Contributor
- Posts: 214
- Joined: Mon Mar 10, 2003 6:12 am
- Location: Johannesburg,South Africa
about the restriction of file types, i use the following piece of code to check for valid image types:
Code: Select all
// an array of valid file types allowed
$valid_image_types = array("jpg","jpeg","gif","png","bmp"); // uploadable images
if (!in_array(strtolower($_FILES["{$var_prefix}icon"]["type"]),$valid_files_image_types))
{
$icon_message = "Invalid Image Type: ".$_FILES["{$var_prefix}icon"]["type"]." ".$_FILES["{$var_prefix}icon"]["error"];
$validation_passed++; // general validation failure
$icon_validation++; // icon validation failure
} // if (!in_array(strtolower($_FILES["{$var_prefix}icon"]["type"]),$valid_files_image_types))- thomas777neo
- Forum Contributor
- Posts: 214
- Joined: Mon Mar 10, 2003 6:12 am
- Location: Johannesburg,South Africa
-
brendandonhue
- Forum Commoner
- Posts: 71
- Joined: Mon Sep 25, 2006 3:21 pm
thomas777neo - The image filetypes you listed can all be checked by getimagesize()
For video files, you can use the ffmpeg-php extension to load the movie then do getFrame(), toGDImage(), and then use imagepng() or imagejpeg(), etc., to get your screenshot into a usable format. You need to have both ffmpeg-php and GD installed to do this.
For video files, you can use the ffmpeg-php extension to load the movie then do getFrame(), toGDImage(), and then use imagepng() or imagejpeg(), etc., to get your screenshot into a usable format. You need to have both ffmpeg-php and GD installed to do this.
-
brendandonhue
- Forum Commoner
- Posts: 71
- Joined: Mon Sep 25, 2006 3:21 pm