video upload and submit button

video upload and submit button

Page 1 of 1

9 Replies - 8464 Views - Last Post: 26 April 2010 - 03:05 PM Rate Topic: -----

#1 Guest_soberchief*


Reputation:

video upload and submit button

Posted 24 April 2010 - 09:46 AM

Hi
I need help
I am creating a file system for my laptop and i am usiing wamp as my server. I can upload a file up to my server no bother, but when i try i video i get an error with the submit button. I want to be able to put a small video up there, do i need a max_file_size method included. PLease help . . . . :(

This is my html file(upload.html)
<html>
<body>

<form action="upload.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="16777000" />

<table>
<tr>
	<td>Heading:</td>
	<td><input type="text" name ="Heading"></td>
</tr>
<tr>
    <td>Description:</td>
	<td><textarea name="Description"  cols="35" rows="5"></textarea></td>
</tr>
<tr>
    <td></td>
    <td><input type="file" name="testfile" id="file"></td>

</tr>
<tr>
	<td></td>
    <td><input type="submit" name="submitbutton" value="Submit"></td>

</tr>
</table>
</form>

</body>
</html>

And this is my php file (upload.php)

<?php

echo "<title>PHP File Upload</title>";

if ($_POST["submitbutton"])
 {
  $heading = $_POST["Heading"];
  $description  = $_POST["Description"];
  $name = $_FILES["testfile"]["name"];
	/*if($name == $_SESSION["last_file_name"]) 
	   {
	   die("File already uploaded");
	   }*/
  $type =$_FILES["testfile"]["type"];
  $size = $_FILES["testfile"]["size"];
  $tmp_name = $_FILES["testfile"]["tmp_name"];
 // $_SESSION["last_file_name"] = $name;

  echo "<b>" . "File Name: " . "</b>" . $name . "<br />";
  echo "<b>" . "Type of File: " . "</b>" . $type . "<br />";
  echo "<b>" . "File Size: " . "</b>" . $size . "<br />";
  echo "<b>" . "Stored: " . "</b>" . $tmp_name . "<br />";
  
	if($heading && $description)
		{
			require("connection.php");
			$date = date("d-M-Y");
			
			$query = mysql_query("INSERT INTO filesuploaded VALUES('','$heading', '$description', '$date' )");
			move_uploaded_file($tmp_name,'filesuploaded/'. $name);
			echo "<b>" . "The file " . "</b>" . $name . "<b>" . " has been uploaded <br><br> <a href='download.php?file=$heading'>Download file </a>" . "</b>" ;
		}
	else
		{
			echo "Your heading and Description has not been filled .$form";
		}
		//header("location:download.php");
  }
  
else
 
   //echo "$form";
   echo "file not uploaded";
 
 
?>


The connection.php is the fiel that connect to mysql

please help me

This post has been edited by JackOfAllTrades: 24 April 2010 - 11:18 AM
Reason for edit:: Added code tags.


Is This A Good Question/Topic? 0

Replies To: video upload and submit button

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6064
  • View blog
  • Posts: 23,519
  • Joined: 23-August 08

Re: video upload and submit button

Posted 24 April 2010 - 11:18 AM

Don't tell us you have errors and not post them. We're not psychic.
Was This Post Helpful? 0
  • +
  • -

#3 Arenlor  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 34
  • View blog
  • Posts: 389
  • Joined: 26-April 06

Re: video upload and submit button

Posted 24 April 2010 - 04:14 PM

Is it greater than 2MB is size? Check your php.ini for http://www.php.net/m...ad-max-filesize and http://www.php.net/m...i.post-max-size to increase them.
Was This Post Helpful? 0
  • +
  • -

#4 Guest_soberchief*


Reputation:

Re: video upload and submit button

Posted 25 April 2010 - 01:31 PM

Notice: Undefined index: submitbutton in C:\wamp\www\upload\upload.php on line 5

This is the error i get when i tried to upload a 25mb video to my server
Was This Post Helpful? 0

#5 Arenlor  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 34
  • View blog
  • Posts: 389
  • Joined: 26-April 06

Re: video upload and submit button

Posted 25 April 2010 - 01:52 PM

Submit buttons don't get passed along, you'd need something like input type="hidden". Change
if ($_POST["submitbutton"])

to
if (isset($_POST["Heading"]))

Was This Post Helpful? 0
  • +
  • -

#6 Guest_soberchief*


Reputation:

Re: video upload and submit button

Posted 25 April 2010 - 02:24 PM

the error went with the submit button thank you :) but i go to 'file not uploaded' which is in my if else statement in my upload.php file, would it be because of the video file size ??
Was This Post Helpful? 0

#7 Arenlor  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 34
  • View blog
  • Posts: 389
  • Joined: 26-April 06

Re: video upload and submit button

Posted 25 April 2010 - 03:32 PM

Yes, PHP's default is 2MB. If you didn't change as per above then that's likely it. Test with a smaller file though first too, just to make sure that's all that's going wrong.
Was This Post Helpful? 0
  • +
  • -

#8 Guest_soberchief*


Reputation:

Re: video upload and submit button

Posted 26 April 2010 - 04:04 AM

ok the submit button line you gave me didnt work so i change it back to what it was before. I see now it because of the file size you mention above "2mb", i can upload anything even a video under 2 mb but how can you change that to a bigger size? and when a file is uploaded i want to know how can you view it up on the server e.g. when i hit submit the next page shows the file i upload it and say something link view file . .
Was This Post Helpful? 0

#9 Guest_soberchief*


Reputation:

Re: video upload and submit button

Posted 26 April 2010 - 04:43 AM

ok i got the file size changed so that area is ok :) just want to know about the view file when uploaded e.g. when you click submit, the next page will say file uploaded and a link will say view file . .
Was This Post Helpful? 0

#10 Arenlor  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 34
  • View blog
  • Posts: 389
  • Joined: 26-April 06

Re: video upload and submit button

Posted 26 April 2010 - 03:05 PM

Well it has to process the file first, and move it to wherever you're keeping it. Then you just give a link to it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1