Hi I don't get this it works fine but any file i upload that is over 300kb doesn't get emailed or saved to the server but if i upload two files for example 260kb 290kb they both upload and are both saved to the server. here is what I am using.
Why is this doing this I find this very odd why if 1 file is more than 300kb??

<form name="iapply3" method="post" action="../submit/isubmit.php" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="10000000" />
<input type="hidden" name="usename" value="johnny99" />
<table class="form">


<tr><td colspan="2" class="head">PHOTO 1</td></tr>
<tr><td colspan="2" class="name"><input type="file" name="fileatt[]" /></td></tr>

<tr><td colspan="2" class="head">PHOTO 2</td></tr>
<tr><td colspan="2" class="name"><input type="file" name="fileatt[]" /></td></tr>

<tr><td colspan="2" class="head">SEND LATER</td></tr>
<tr><td colspan="2" class="selection"><input type="checkbox" name="later" value="Yes" /></td></tr>

<tr><td class="head">&nbsp;</td><td class="head">&nbsp;</td></tr>


<tr><td colspan="2" class="submit" ><input name="submit" type="submit" value="Submit" /></td></tr>
<tr><td colspan="2" class="submit"><input name="reset" type="reset" value="Reset" /></td></tr>

<tr><td class="head">&nbsp;</td><td class="head">&nbsp;</td></tr>

</table>
</form>
</body>
</html>
<? 
session_start();
error_reporting(apa);
error_reporting(7);
include("../secure/global/connection.php");

$username = $_POST["username"];

mkdir("../secure/admin/clients/$username", 0700);

			


        $to = 'info@website.com';
        $subject = "Success";
        $boundary = '==Multipart_Boundary_x' .md5(time()). 'x';
        // headers
        $headers .= "From: Website <noreply@websire.com>\n";  
        $headers .= "MIME-Version: 1.0\n";
        $headers .= "Content-Type: multipart/mixed;\n boundary=\"$boundary\"\n\n";
        // message
        $message = "--{$boundary}\n";
        $message .= "Content-Type: text/html; charset=iso-8859-1\n";
        $message .= "Content-Transfer-Encoding: 7bit\n\n";
        $message .= "<html>
<head>
<title>HTML message</title>

</head>
<body>

message here

</body>
</html>";




foreach ($_FILES["fileatt"]["error"] as $key => $error) { 
        if ($error == UPLOAD_ERR_OK) { 
$fileatt = $_FILES['fileatt']['tmp_name'][$key];
$fileatt_type = $_FILES['fileatt']['type'][$key];
$fileatt_name = $_FILES['fileatt']['name'][$key]; 

       
        // attachment

        $fp = fopen($fileatt, 'rb');
        $data = fread($fp, filesize($fileatt));
        fclose($fp);

        $data = chunk_split(base64_encode($data));
        $message .= "\n\n";
        $message .= "--{$boundary}\n";
        $message .= "Content-Type: application/$fileatt_type; name=\"$fileatt_name\"\n";
        $message .= "Content-Transfer-Encoding: base64\n\n";
        $message .= "$data\n\n";

move_uploaded_file($fileatt, "./../secure/admin/clients/$username/$fileatt_name"); 
       
    } 
}


        mail($to, $subject, $message, $headers);
?>

Try placing the following at the top of your php file(s) that process the uploads:

ini_set ('upload_max_filesize','10M');

That should allow the server to accept 10 Megabyte files and is the most common solution for this problem from previous posts of simular/same problems on these forums. Let me know if you need more info.

Glad to see you didn't back onto a 3 year old post :icon_biggrin:

Try placing the following at the top of your php file(s) that process the uploads:

ini_set ('upload_max_filesize','10M');

That should allow the server to accept 10 Megabyte files and is the most common solution for this problem from previous posts of simular/same problems on these forums. Let me know if you need more info.

Glad to see you didn't back onto a 3 year old post :icon_biggrin:

Hi cwarn...
Ur code is working good for me also....
i have another doubt?
can we modify through php.ini.....?

that worked a treat thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.