Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9297149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T21:59:49+00:00 2026-06-18T21:59:49+00:00

I want to upload video files using php and the html form, the php

  • 0

I want to upload video files using php and the html form, the php code and the error as follows.

I can upload almost any other file type (image, zip, text etc after changing relevant code) except videos (.mp4, .flv, .avi).

UPDATE: I’ve uploaded the form as an image:
enter image description here

 <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');

// 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'] > $_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) < 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..

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 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).

Thanks in advice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T21:59:50+00:00Added an answer on June 18, 2026 at 9:59 pm

    For the life of me, I can’t really figure out what’s wrong here. I do have a suggestion though, and that is to upgrade your installation of XAMPP to the latest version. Usually upgrading fixes whatever bugs are present in the previous install. I am myself currently running on 1.8.1, and was unable to reproduce your error, so maybe if you upgrade, it will fix whatever was amiss.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to upload and store video files to my server using PHP. Could
I want to upload video (basically large files) without using Flash Plugin. It would
I want to upload video using uploadify newest version, but I failed. My code:
I want that through my web page user could upload audio/video files & it
I need to convert mp3 files into mp4 or any other video formats, with
I am using UIImagePickerController to choose video file from library. And user can upload
I want to upload video on Facebook . for this I am using my
So I'm using Codeigniter and I want to upload files. It's working fine except
I want to use a video player using html 5 and flash. Now the
I want to upload image, audio and video files from my app. If I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.