Note that there are some explanatory texts on larger screens.

plurals
  1. POError uploading video file in php
    primarykey
    data
    text
    <p>I want to upload video files using php and the html form, the php code and the error as follows. </p> <p>I can upload almost any other file type (image, zip, text etc after changing relevant code) except videos (.mp4, .flv, .avi).</p> <p>UPDATE: I've uploaded the form as an image: <img src="https://i.stack.imgur.com/7w9jc.jpg" alt="enter image description here"></p> <pre><code> &lt;form enctype="multipart/form-data" action="saveVideo.php" method="post" &gt; &lt;input type="text" name="txtCardNo" size="6" maxlength="6"autofocus required/&gt; &lt;input type="file" name="video" required/&gt; &lt;input type="hidden" name="MAX_FILE_SIZE" value="26214400" /&gt; &lt;input type="submit" value="Submit" class="ok"/&gt; </code></pre> <p><strong>saveVideo.php:</strong></p> <pre><code>require_once('config.php'); // get info from the form $card = trim($_POST['txtCardNo']); //7th line (error 1) // directory where Videos will be saved $target = "videos/"; $target = $target . basename($card . ".mp4"); //rename the video $video = $card . ".mp4"; //name saved in the db echo $_FILES["video"]["type"]; //14th line (error 2) if ($_FILES["video"]["type"] == "video/mp4"){ //check for .mp4 if ($_FILES['video']['size'] &gt; $_POST['MAX_FILE_SIZE']){ //check file size $_SESSION['error'] = "Video size should be less than 25MB.!"; }else{ $check = mysql_query("SELECT SN FROM Videos WHERE CardNo = '$card'"); //check for existing image if (mysql_num_rows($check) &lt; 1){ $sql_query = "INSERT INTO Videos (CardNo, Video, Date) VALUES ('$card', '$video', NOW())"; }else{ $sql_query = "UPDATE Videos SET CardNo ='$card', Video = '$video', Date = NOW() WHERE 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 to 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 only .mp4, video format.!"; } etc.. </code></pre> <p><strong>Error:</strong></p> <pre><code>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 </code></pre> <p>I've used the same code (with image attributes) for image upload and it worked perfectly. But when uploading video this gave me lot of errors and some are corrected. Now I can't get the post data from the form in to the saveVideo.php (I checked the 7th and 14th line but no success). </p> <p>Thanks in advice.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload