upload - Error uploading video file in php -
i want upload video files using php , html form, php code , error follows.
i can upload other file type (image, zip, text etc after changing relevant code) except videos (.mp4, .flv, .avi).
update: i've uploaded form image:
<form enctype="multipart/form-data" action="savevideo.php" method="post" > <input type="text" name="txtcardno" size="6" maxlength="6"autofocus required/> <input type="file" name="video" required/> <input type="hidden" name="max_file_size" value="26214400" /> <input type="submit" value="submit" class="ok"/>
savevideo.php:
require_once('config.php'); // info form $card = trim($_post['txtcardno']); //7th line (error 1) // directory videos saved $target = "videos/"; $target = $target . basename($card . ".mp4"); //rename video $video = $card . ".mp4"; //name saved in db echo $_files["video"]["type"]; //14th line (error 2) if ($_files["video"]["type"] == "video/mp4"){ //check .mp4 if ($_files['video']['size'] > $_post['max_file_size']){ //check file size $_session['error'] = "video size should less 25mb.!"; }else{ $check = mysql_query("select sn videos cardno = '$card'"); //check existing image if (mysql_num_rows($check) < 1){ $sql_query = "insert videos (cardno, video, date) values ('$card', '$video', now())"; }else{ $sql_query = "update videos set cardno ='$card', video = '$video', date = now() cardno = '$card' limit 1";} if(mysql_query($sql_query, $dblink) or die(mysql_error())){ if(move_uploaded_file($_files['video']['tmp_name'], $target)){ //move video videos folder $_session['error'] = "the file ". basename( $_files['video']['name']). " uploaded successfully.!"; }else { $_session['error'] = "error moving record.!"; } }else{ $_session['error'] = "error updating record.!"; }} }else{ $_session['error'] = "invalid file type. allowed .mp4, video format.!"; } etc..
error:
notice: undefined index: txtcardno in c:\xampp\htdocs\video\savevideo.php on line 7 notice: undefined index: video in c:\xampp\htdocs\video\savevideo.php on line 14
i've used same code (with image attributes) image upload , worked perfectly. when uploading video gave me lot of errors , corrected. can't post info form in savevideo.php (i checked 7th , 14th line no success).
thanks in advice.
for life of me, can't figure out what's wrong here. have suggestion though, , upgrade installation of xampp latest version. upgrading fixes whatever bugs nowadays in previous install. myself running on 1.8.1, , unable reproduce error, maybe if upgrade, prepare whatever amiss.
php upload
No comments:
Post a Comment