Hi all..i have a problem that i want to upload file less than 5MB..but it doesn't work for file size more than 3MB..what happen huh? Please help me..
<?php
include "connection/db_connect.php";
include "template.php";
$reqid=$_GET['reqid'];
if (($_FILES["file"]["type"])
&& ($_FILES["file"]["size"] < 5000000000000))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
$filename = $_FILES["file"]["name"];
$filetype = $_FILES["file"]["type"];
$size = ($_FILES["file"]["size"]/ 1024);
$path = $_FILES["file"]["tmp_name"];
$dir = "upload/" . $_FILES["file"]["name"];
$query = "INSERT INTO attachment (reqid, fileName, size, fileType,tmpName ) ".
"VALUES ('$reqid', '$filename', '$size', '$filetype', '$dir')";
mysql_query($query) or die('Error, query failed : ' . mysql_error());
if (file_exists("upload/" . $_FILES["file"]["name"]))
{
echo "<script language='javascript'>alert('Sorry! File already exists. Please change the filename' );</script>";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"upload/" . $_FILES["file"]["name"]);
echo $dir;
}
}
}
else
{
echo "<script language='javascript'>alert('Sorry!! File should be less then 5MB!');</script>";
}
?>