PDA

View Full Version : Uploader (right forum this time!)


panoramical
09-02-2004, 06:11 PM
Hello
I have made an upload script for people to upload all their files with, but unfortunately they cannot upload more than 2mb. My code is below:

:<?php

if (isset($_POST['submit']))
{
$root= "";
$webroot = "";
$path = "";
$company = "";
$myemail = "";

if (!$_POST['email'])
{
$vemail="";
}
else
{
$vemail=$_POST['email'];
}


if (!isset($HTTP_POST_FILES['userfile'])) exit;

if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name']))
{

if (file_exists($path . $HTTP_POST_FILES['userfile']['name'])) { echo "The file already exists<br>\n"; exit; }

$res = copy($HTTP_POST_FILES['userfile']['tmp_name'], $root.$path.$HTTP_POST_FILES['userfile']['name']);

if (!$res) { echo "upload failed!<br>\n"; exit; } else { echo "upload sucessful<br>\n"; }

echo "File Name: ".$HTTP_POST_FILES['userfile']['name']."<br>\n";
echo "File Size: ".$HTTP_POST_FILES['userfile']['size']." bytes<br>\n";
echo "File Type: ".$HTTP_POST_FILES['userfile']['type']."<br>\n";
echo "Email Address: $vemail";

$todayis = date("l, F j, Y, g:i a") ;
$subject = "Image ".$HTTP_POST_FILES['userfile']['name']." uploaded by $email.";
$message = " $todayis [EST] \n
Message: File Uploaded \n
From: Image Upload ($myemail)\n
";

$from = "From: $vemail\r\n";

mail($myemail, $subject, $message, $from);

echo "$company Notified of this Upload. Thank you.<br>";
echo "<a href=\"$webroot$path".$HTTP_POST_FILES['userfile']['name']."\">View File</a><br>";
echo "<a href=\"java script:window.close()\">Close Window</a>";

}
else
{
echo "Wrong file type<br>\n"; exit;
}

}
else
{

?><TITLE>RCTDUSV2</TITLE>
<BODY BGCOLOR="#FFFFFF">
<P><FONT FACE="Tahoma" SIZE="2"><IMG SRC="logo.gif" WIDTH="468" HEIGHT="50"> </FONT></P><P><FONT FACE="Tahoma" SIZE="2"><B>Welcome
</B>to the pulp of Uploading Services - here at RCT Dimension, we have optimized
our service to suit users' needs. Now, you can be assured that your files will
be safe with us, as there is no chance they will ever be overwitten or deleted
by anybody. Once you upload here, it's never gone.</FONT></P><P><FONT FACE="Tahoma" SIZE="2"><B>Any
problems, email </B>panoramical@travisfans.co.uk</FONT></P><form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
<table border="0" cellpadding="0" cellspacing="5" style="border-collapse: collapse" bordercolor="#111111" width="450" id="AutoNumber1">
<tr> <td width="111"><FONT FACE="Tahoma" SIZE="2"><b>File:</b></FONT></td><td width="217">
<FONT FACE="Tahoma" SIZE="2"><INPUT TYPE="file" NAME="userfile" SIZE="20"></FONT></td><td width="112">
<FONT FACE="Tahoma" SIZE="2"><input type="submit" name="submit" value="Upload" size="20">
</FONT></td></tr> </table></form><FONT FACE="Tahoma" SIZE="2"><?php

}

?></FONT>





Is there any way to tweak this to make it say, 20mb limit?
Thanks

Josh
09-02-2004, 06:18 PM
You would have to have your host change it in php.ini