Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
This is my form

PHP
<form name="regForm" action="insertvideo.php" enctype="multipart/form-data" method="post"  önSubmit="return validateForm()">
Video Description<input type="text" name="desc" size=32>
Front Picture<input type="file" name="file1" width="300">
Upload Video<input type="file" name="file2" width="300">
<input type="submit" name="submit" value="Upload Video">
</form>


This is the the insert code

PHP
<?php

  
$allowedExts = array("jpg", "jpeg", "gif", "png","bmp");
$extension = end(explode(".", $_FILES["file1"]["name"]));
require "config.php";   
      $query2=" SELECT id FROM videodetails order by id desc limit 1";
      $result2=mysql_query($query2);
      echo mysql_error();
	  $nume=1;
while ($row1 = mysql_fetch_array($result2)) {
$nume = $row1['id'];
}
      $nume=$nume+1;
	  $filename=$nume . ".jpg";
if ((($_FILES["file1"]["type"] == "image/gif")
|| ($_FILES["file1"]["type"] == "image/jpeg")
|| ($_FILES["file1"]["type"] == "image/jpg")
|| ($_FILES["file1"]["type"] == "image/png")
|| ($_FILES["file1"]["type"] == "image/bmp")
|| ($_FILES["file1"]["type"] == "image/pjpeg"))
)
  {
  if ($_FILES["file1"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file1"]["error"] . "<br />";
	exit;
    }
  else
    {
      move_uploaded_file($_FILES["file1"]["tmp_name"],"video/" . $filename);
    }
  }
else
  {
  echo "Invalid file";
  exit;
  }
//-------------------------- uploading the video----------------------------------

$allowedExts2 = array("flv", "avi", "mp4", "mov","dat","mpeg","mpg");
$extension2 = end(explode(".", $_FILES["file2"]["name"]));
$filename2=$nume . ".flv";
 if ($_FILES["file2"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file2"]["error"] . "<br />";
	exit;
    }
  else
    {
     move_uploaded_file($_FILES["file2"]["tmp_name"],"video/" . $filename2);
    }

//---------------------------------------------------------------------------------
$name = $_POST['name'];
$desc = $_POST['desc'];
$file_name= $filename;
$order = "INSERT INTO videodetails(album,description,frontpic,url)VALUES ('$name','$desc','$file_name','$video_name')";
$result = mysql_query($order);
if (mysql_errno())
  echo mysql_error();
echo "Video uploaded successfully!";
?>


I want to display a progress bar with the uploading progress in %.

Is it possible in php.
Please help.
Posted
Comments
enhzflep 10-Oct-12 4:47am    
This looks promising: PHP Upload progress
[no name] 10-Oct-12 5:44am    
I can't solve my problem through that
enhzflep 10-Oct-12 5:51am    
Why not?

Simply saying "I cant solve my problem through that" denies other readers the information (that you already have) that would assist in solving _your_ problem.
[no name] 10-Oct-12 12:27pm    
I have two files 1 html form
another php code to insert and upload
But they are using only one file file for upload and form.
suggest
enhzflep 10-Oct-12 13:03pm    
Sure thing. The intended article on the page I linked you to was for Valum's file-uploader. You can get that here, if you didn't already: File Uploader

I'm too tired to reads the documentation right now. But it certainly does seperate the code into several files - ones the user will see and ones that sit on the server, waiting to receive the uploaded file and save it to disk. I think you need files out of the 'server' folder too - found on the gitHub page I linked to.

Looking at line 30 of demo.htm, we can see the 2nd file being specified.

:-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900