Jump to content

[SOLVED] 300kb upload problem?


shadiadiph

Recommended Posts

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"> </td><td class="head"> </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"> </td><td class="head"> </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 = '[email protected]';
        $subject = "Success";
        $boundary = '==Multipart_Boundary_x' .md5(time()). 'x';
        // headers
        $headers .= "From: Website <[email protected]>\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);
?>

Link to comment
https://forums.phpfreaks.com/topic/145730-solved-300kb-upload-problem/
Share on other sites

There are several settings that limit this, in the php.ini and the apache server itself.  These are covered here:  http://us3.php.net/manual/en/features.file-upload.common-pitfalls.php.  One or both may be limiting your file size.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.