954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Upload Variables not getting passed

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' />
 <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.

Attachments 2b784924b176a4b79de88baa52a9edc7.png 28.76KB
Alternativeguy
Newbie Poster
1 post since Jul 2011
Reputation Points: 10
Solved Threads: 0
 

Line 15 of your code:

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

needs to change to:

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

with no space between "['myfile']['type']"
Other than that your code worked for me.

ddymacek
Posting Whiz
317 posts since Jun 2010
Reputation Points: 36
Solved Threads: 64
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: