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 9150349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:36:00+00:00 2026-06-17T11:36:00+00:00

below I have an iframe which deals with a file input: var $fileVideo =

  • 0

below I have an iframe which deals with a file input:

var $fileVideo = $("<form action='videoupload.php' method='post' enctype='multipart/form-data' target='upload_target_video' onsubmit='return videoClickHandler(this);' class='videouploadform' >" + 
"Video File: <input name='fileVideo' type='file' class='fileVideo' /></label>" +  
"<input type='submit' name='submitVideoBtn' class='sbtnvideo' value='Upload' /></label>" + 
 "<p class='listVideo' align='left'></p>" +
"<iframe class='upload_target_video' name='upload_target_video' src='/' style='width:0px;height:0px;border:0px;solid;#fff;'></iframe></form>"); 

Now I have a function below where when the file has stopped uploading and has successfully uploaded into the server, it will display the name of the file uploaded:

    function stopVideoUpload(success, videofilename){

      var result = '';
      videocounter++;

      if (success == 1){
         result = '<span class="videomsg'+videocounter+'">The file was uploaded successfully</span>';
          $('.listVideo').eq(window.lastUploadVideoIndex).append('<div>' + htmlEncode(videofilename) + 
          '<input type="text" name="videoidhide" value=""/><br/><hr/></div>');
      }


      return true;   
}

You will also see that there is a text input next to the file name. This is relevant to my question.

Below is the php script the frame links to videoupload.php and this script will upload the files and insert the data into the database:

     move_uploaded_file($_FILES["fileVideo"]["tmp_name"],
      "VideoFiles/" . $_FILES["fileVideo"]["name"]);
      $result = 1;

    $videosql = "INSERT INTO Video (VideoFile) 
    VALUES (?)";

        if (!$insert = $mysqli->prepare($videosql)) {
      // Handle errors with prepare operation here
    }

            //Dont pass data directly to bind_param store it in a variable
$insert->bind_param("s",$vid);

//Assign the variable
$vid = 'VideoFiles/'.$_FILES['fileVideo']['name'];

 $insert->execute();

        if ($insert->errno) {
          // Handle query error here
        }

        $insert->close();     

?>

 <script language="javascript" type="text/javascript">
 window.top.stopVideoUpload(<?php echo $result; ?>, '<?php echo $_FILES['fileVideo']['name'] ?>');
 </script>  

Below is an example database showing the insert of the file:

Video_Question Table:

 VideoId (PK auto)  VideoFile
 1                  VideoFiles/carrace.mp4
 2                  VideoFiles/cricket.mov

Now what my question is that where you see in the mysqli code where it inserts the uploded video file into the VideoFile field in the db, how can I retrieve the value from the VideoId field and display it in the text input for each associated uploaded file?

For example if carrace.mp4 was uploaded, then retrieve the VideoId 1 from the db and display it in the text input next to the name of the uploaded file.

  • 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-17T11:36:01+00:00Added an answer on June 17, 2026 at 11:36 am

    Just call $mysqli->insert_id and append it to the file name before you call the function stopVideoUpload

    Also $vid needs to be assigned before you bind it, not after

         $insert->execute();
         $id = $mysqli->insert_id;
            if ($insert->errno) {
              // Handle query error here
            }
    
            $insert->close();     
    
    ?>
    
     <script language="javascript" type="text/javascript">
     window.top.stopVideoUpload(<?php echo $result; ?>, '<?php echo $id. $_FILES['fileVideo']['name'] ?>');
     </script>  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

var $fileVideo = $(<form action='videoupload.php' method='post' enctype='multipart/form-data' target='upload_target_video' onsubmit='return videoClickHandler(this);' class='videouploadform' > + Video
I am working on a php/HTML web project and I have a form which
I have a class which enables forms with a file-type input to be submitted
I have a form which uses the target attribute to target an iframe when
Below I have a line of code where it states which Session a user
I have below snippet of code in which TestClass is extending jPanel which is
I have a ModalPopupExtender control and a panel which contains a iframe. The ModalPopupExtender's
I have a name value pair array in Javascript (just like form.SerializeArray()) which i
I have a php script below known as cancelimage.php where it will display a
I have a php script below known as cancelimage.php where it will display a

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.