Im trying to create a upload script to upload some images. However it wont upload any images that are over 2.15 mb. Can anyone help? script is below
UPLOAD FORM
PHP Code:<?php // ini_set ('display_errors', true );
require_once('../spaw/spaw_control.class.php');
require_once('../../classes/admin.class.php'); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>EPC Website Administration: Occasional Papers</title>
<link href="../../css/epc_admin.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/JavaScript">
<!--
function BRB_PHP_DelWithCon(deletepage_url,field_name,field_value,messagetext) { //v1.0 - Deletes a record with confirmation
if (confirm(messagetext)==1){
location.href = eval('\"'+deletepage_url+'?'+field_name+'='+field_value+'\"');
}
}
//-->
</script>
<script src="../../includes/sorttable.js"></script>
</head>
<body>
<div id="heading">
<div class="clear"></div>
</div>
<div id="main">
<form method="post" action="add.php" enctype="multipart/form-data">
<table border="0" cellpadding="0" cellspacing="0" class="editform" id="diary">
<tr>
<th scope="row">File:</th>
<input type="hidden" name="max_file_size" value="3000" />
<td><input type="file" name="userfile" size="50" /></td>
</tr>
<tr>
<th scope="row"> </th>
<td><input name="Submit" type="submit" title="Sumbit" value="Save"/></td>
</tr>
</table>
</form>
<p> </p>
</div>
</body>
</html>
UPLOAD SCRIPT
PHP Code:<?php
require_once('../../classes/admin.class.php');
//Catch the file uploaded
$userfile = $_FILES['userfile']['tmp_name'];
$userfile_name = $_FILES['userfile']['name'];
$userfile_size = $_FILES['userfile']['size'];
$userfile_type = $_FILES['userfile']['type'];
$userfile_error = $_FILES['userfile']['error'];
if ($userfile_error > 0)
{
$msg = 'Problem: ';
switch ($userfile_error)
{
case 1: echo 'File exceeded uploaded_max_filesize'; break;
case 2: echo 'File exceeded max_file_size'; break;
case 3: echo 'File only partially uploaded'; break;
case 4: echo 'No file uploaded'; break;
}
exit;
}
$upfile = 'C:/Inetpub/wwwroot/demo1/upload/'.$userfile_name;
if (is_uploaded_file($userfile))
{
if (!move_uploaded_file($userfile, $upfile))
{
$msg = 'Problem: Could not move file to destination directory';
exit;
}
}
else
{
$msg = 'Possible file upload attack. Filename: '.$userfile_name;
exit;
}
$msg = 'File: '.$userfile_name.' uploaded succesfully';
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>EPC Website Administration: Occasional Papers</title>
<link href="../../css/epc_admin.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/JavaScript">
<!--
function BRB_PHP_DelWithCon(deletepage_url,field_name,field_value,messagetext) { //v1.0 - Deletes a record with confirmation
if (confirm(messagetext)==1){
location.href = eval('\"'+deletepage_url+'?'+field_name+'='+field_value+'\"');
}
}
//-->
</script>
<script src="../../includes/sorttable.js"></script>
</head>
<body>
<div id="heading">
<h1><a href="../index.php">Website Adminstration</a>: Occasional Papers </h1>
<img src="/images/global/logo.gif" alt="EPC Logo" width="110" height="105" />
<div class="clear"></div>
</div>
<div id="main">
[<a href="index.php">Add Another Image</a>]</p>
<p><?php echo $msg; ?></p>





Bookmarks