techiefreak05 Posted April 6, 2007 Share Posted April 6, 2007 I have the following script that works very well for images. and im looking to start a video upload feature, how would i change the following script to a video upload script? I heard that i could just change my script to let videos and it should work. <?php //print_r($_POST); if($_POST["action"] == "-Upload-") { unset($imagename); if(!isset($_FILES) && isset($HTTP_POST_FILES)) $_FILES = $HTTP_POST_FILES; if(!isset($_FILES['image_file'])) $error["image_file"] = "An image was not found."; $imagename = basename($_FILES['image_file']['name']); //echo $imagename; //$max_space = 524288; $files = array("image/gif", // Gif "image/jpeg", // jpe jpeg jpg "png", // PNG "image/JPEG", ); $picfile_size = $_FILES['image_file']['size']; $picfile_type = $_FILES['image_file']['type']; if(! in_array($picfile_type, $files)) { $error = "<b>File was not allowed! Only gif,png,jpg,jpeg</b>"; } if(empty($imagename)) $error["imagename"] = "The name of the image was not found."; if(empty($error)){ $newimage = "files/uploads/" . $_SESSION[username] . "/" . $imagename; mysql_query("INSERT INTO `images` ( `imgPath` , `headline` , `id` , `userid`, `aID`) VALUES ('http://s191754240.onlinehome.us/$newimage', '', '', '$_SESSION[id]', '$_POST[album_select]');") or die(mysql_error()); echo "<meta http-equiv=\"refresh\" content=\"0;url=managePhotos.php\">"; ?> <font color="red"><b>Image Upload Successful!</b></font> <?php $result = @move_uploaded_file($_FILES['image_file']['tmp_name'], $newimage); if(empty($result)) $error["result"] = "There was an error moving the uploaded file."; } } echo $error.$error["image_file"] ?> Link to comment https://forums.phpfreaks.com/topic/45827-image-upload-script-into-a-video-upload-script/ Share on other sites More sharing options...
MadTechie Posted April 6, 2007 Share Posted April 6, 2007 change $files = array("image/gif", // Gif "image/jpeg", // jpe jpeg jpg "png", // PNG "image/JPEG", ); to include the video types you wish to upload ie $files = array("image/gif", // Gif "image/jpeg", // jpe jpeg jpg "png", // PNG "image/JPEG", "video/x-msvideo", "video/quicktime", "video/mpeg", ); here a nice referance http://www.w3schools.com/media/media_mimeref.asp Link to comment https://forums.phpfreaks.com/topic/45827-image-upload-script-into-a-video-upload-script/#findComment-222694 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.