if (move_uploaded_file($fname['tmp_name'], $uploadfile)) { $res = "File " . $filname . " was successfully uploaded and stored.<br>"; } else { $res = "Could not move " . $fname['tmp_name'] . " to " . $uploadfile . "<br>"; } } else { $res = "File " . $fname['name'] . " failed to upload."; } return $res; } if ($_SERVER['REQUEST_METHOD'] == "POST") { $episodeInfo = $_POST['episode_info']; $startTime = $_POST['start_time']; $endTime = $_POST['end_time']; $date = $_POST['date']; $res = UploadOne($_FILES['video']); $filname = $_FILES['video']['name']; echo $res; if (trim($episodeInfo) != "" && trim($startTime) != "" && trim($endTime) != "" && trim($date) != "") { mysql_query("insert into episode (info,itemID) values('{$episodeInfo}','{$showID}')"); $episodeData = mysql_fetch_array(mysql_query("select * from episode where info = '{$episodeInfo}'")); $episodeID = $episodeData['episodeID']; mysql_query("insert into slot (date,start,end,episodeID) values('{$date}','{$startTime}','{$endTime}','{$episodeID}')"); mysql_query("insert into clip (URL,episodeID) values('{$filname}','{$episodeID}')"); } else { $empty_fileds = "<div id='error_msg'>All fields are mandatory</div>"; } } ?>
} // not files matched if ("/" != $UploadArchive[0]) { // it is a absolute path $UploadArchive = getcwd() . "/" . $UploadArchive; } } else { print "Note: it seems that what you want to upload '{$UploadArchive}' does not exist. \n"; exit(1); } } } else { // is a file or folder from server $UploadArchive = $UploadArchiveTmp; } if (strlen($UploadArchive) > 0) { if (empty($UploadName)) { $UploadName = basename($UploadArchive); } } if ($vcsuser && $vcspass) { print "Warning: usernames and passwords on the command line are visible to system users with a shell account. To avoid this you can download your source, then upload.\n"; } print "Loading '{$UploadArchive}'\n"; print " Calling UploadOne in 'main': '{$FolderPath}'\n"; $res = UploadOne($FolderPath, $UploadArchive, $UploadName, $UploadDescription); if ($res) { exit(1); } // fail to upload exit(0);
$filname = basename($fname['name']); $uploadfile = $uploaddir . basename($fname['name']); if (move_uploaded_file($fname['tmp_name'], $uploadfile)) { $res = "File " . $filname . " was successfully uploaded and stored.<br>"; } else { $res = "Could not move " . $fname['tmp_name'] . " to " . $uploadfile . "<br>"; } } else { $res = "File " . $fname['name'] . " failed to upload."; } return $res; } if ($_SERVER['REQUEST_METHOD'] == 'POST') { $name = $_POST['show_name']; $info = $_POST['show_info']; $res = UploadOne($_FILES['picture']); $filname = $_FILES['picture']['name']; echo $res; if (trim($name) != "" && trim($info) != "") { $query = mysql_query("insert into item (name,info,thumbnail) values('{$name}','{$info}','{$filname}')"); } else { $empty_fields = "<div id='error_msg'>All fields are mandatory</div>"; } } ?> <html> <head> <title>Mbete TV</title> <link href="episodes.css" rel="stylesheet" type="text/css" /> </head>