Re: Question About Uploading files in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The maximum upload in the php.ini may be set to 5Mb. So you look the php.ini file and first change it. Then it will work  :-) . I have not looked the code. But if its working upto 5Mb , then the reason may be this. 

Hari K T

http://www.harikt.com/


--- On Mon, 9/3/09, SaEeDoS <saeedos@xxxxxxxxx> wrote:

From: SaEeDoS <saeedos@xxxxxxxxx>
Subject:  Question About Uploading files in PHP
To: php-objects@xxxxxxxxxxxxxxx
Date: Monday, 9 March, 2009, 10:19 PM











    
            Hi all ,

i'm working on a small project , it's about Uploading files .

i put my project online , i have a domain on http://www.parallel s.com/

.

The Problem :

when i uploading a file that have a size less than 5 MB it success .

but when the size come large than 5 MB nothing happen , the loading bar of the Browser is completed and nothing happen .

there is No error messages .

the original code must redirect the page to the main page after finishing uploading . 

in my code i didn't determine the maximum size of files .

could any one tell me what the wrong in my code , 

Thanks

#### CODE ####

switch($action)

{

case "upload":

		$dir=$session_ user_dir. "/";

		if (($_FILES["file" ]["size"] < 20000666666600) )

	  	{

	  		if ($_FILES["file" ]["error" ] > 0)

	    {

	    	echo "Return Code: " . $_FILES["file" ]["error" ] . "<br />";

	    }

	  	else

	    {

	    	header("Refresh: 2; URL=files.php? act=list" );	

		    echo "<b>Upload</ b>: " . $_FILES["file" ]["name"] . "<br />";

		    echo "<b>Type</b> : " . $_FILES["file" ]["type"] . "<br />";

		    echo "<b>Size</b> : " . ($_FILES["file" ]["size"] / 1024) . " Kb<br />";

		    echo "<b>Temp file</b>: " . $_FILES["file" ]["tmp_name" ] . "<br />";

	    	if (file_exists( "$session_ user_dir/ " . $_FILES["file" ]["name"] ))

	      	{

  	echo $_FILES["file" ]["name"] . "<b>already exists</b>";

	      	}

	    	else

	      	{    		

		  move_uploaded_ file($_FILES[ "file"][" tmp_name" ],

		  $dir. $_FILES["file" ]["name"] );

		  $filePath=$dir. $_FILES[" file"]["name" ];

		      insertFile($ _FILES["file" ]["name"] ,$_FILES[ "file"][" type"],$_ FILES["file" ]["size"] ,$filePath) ;

		      echo "<b>uploading File success</b>< br />";

		      echo "Stored in: " .$dir. $_FILES["file" ]["name"] ;

		      $fileName=$_ FILES["file" ]["name"] ;

		      $fileType=$_ FILES["file" ]["type"] ;

		      $fileSize=$_ FILES["file" ]["size"] ;

		      $currentUser= $session_ fname." ".$session_lname;

		      $uploadDate= time();

		      sendMail($fileName, $fileType, $fileSize, $currentUser, $uploadDate) ;

	      	}

	    }

	  	}

		else

	  	{

	  		header("Refresh: 2; URL=files.php" );

			echo "Invalid file";

	  	}

	  

	  	/** echo "<script type=\"text/ javascript\ ">

		window.location = \"files.php\ "

		</script>"; **/

	break;

}




 

      

    
    
	
	 
	
	








	


	
	


      Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/

[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux