Hey All I have made this upload script but everytime I tried to execute it, it fails and gives me this error.

http://www.daniweb.com/forums/attachment.php?attachmentid=21701&stc=1&d=1311399235

This is my code in the Upload.php File:

<form enctype='multipart/form-data' action='Upload_File.php' method='POST'>
 Please choose a file: <input name='myfile' type='file' /><br />
 <input type='submit' name='submit' value='Upload' />
 </form>

And In the Upload_File.php

<?php
session_start ();
?>


<?php



	
//get file data

$name = $_FILES['myfile']['name'];
$tmp_name = $_FILES['myfile']['tmp_name'];
$type = $_FILES['myfile'] ['type'];
	if($name)
	
	{
		///start upload
		if ($type == "video/mpeg" || $type == "video/quicktime")
		
	     {	
		$location = "uploads/$name";
		
		move_uploaded_file($tmp_name,$location);
	
		header( 'Location: Index.php' ) ;
	
	     }
		else{
		
				echo "<center><p style='color:#FFF'>File Format Not Supported Please Upload a MP4 File!</p></center>";
		}
	}
	
	else
	//die("Please select a file!");
		echo "<center><p style='color:#FFF'>Please select a file!</p></center>";







?>

If anyone could provide support it would be much appreciated.

Line 15 of your code:

$type = $_FILES['myfile'] ['type'];

needs to change to:

$type = $_FILES['myfile']['type'];

with no space between ""
Other than that your code worked for me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.