0

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.

Edited by Alternativeguy: n/a

Attachments 2b784924b176a4b79de88baa52a9edc7.png 28.76 KB
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by ddymacek
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.