Php 表格附件尺寸赢得';不能超过20000 mb

Php 表格附件尺寸赢得';不能超过20000 mb,php,forms,validation,email-attachments,Php,Forms,Validation,Email Attachments,我制作了一个表单,可以让你将文件附加到电子邮件中,但是每当有人添加附件时,表单会限制他们上载任何大于20000 mb的内容,但我已将最大大小设置为远远超过50 mb,有时甚至不允许这么多。我的问题是如何让表单接受大小为50MB或更大的文件?这是我在表单中使用的代码 <!-- Form Code Start --> <form id='contactus' action='<?php echo $formproc->GetSelfScript(); ?>' me

我制作了一个表单,可以让你将文件附加到电子邮件中,但是每当有人添加附件时,表单会限制他们上载任何大于20000 mb的内容,但我已将最大大小设置为远远超过50 mb,有时甚至不允许这么多。我的问题是如何让表单接受大小为50MB或更大的文件?这是我在表单中使用的代码

<!-- Form Code Start -->
<form id='contactus' action='<?php echo $formproc->GetSelfScript(); ?>' method='post' enctype="multipart/form-data" accept-charset='UTF-8'>

<fieldset >
<legend>Upload A File</legend>

<input type='hidden' name='submitted' id='submitted' value='1'/>
<input type='hidden' name='<?php echo $formproc->GetFormIDInputName(); ?>' value='<?php echo $formproc->GetFormIDInputValue(); ?>'/>
<input type='text2'  class='spmhidip' name='<?php echo $formproc->GetSpamTrapInputName(); ?>' />

<div class='short_explanation'>* required fields</div>

 <div><span class='error'><?php echo $formproc->GetErrorMessage(); ?></span></div>
<div class='container2'>
<label for='name' >Your Full Name*: </label><br/>
<input type='text2' name='name' id='name' value='<?php echo $formproc->SafeDisplay('name') ?>' maxlength="50" /><br/>
<span id='contactus_name_errorloc' class='error'></span>
 </div>
<div class='container2'>
<label for='email' >Email Address*:</label><br/>
<input type='text2' name='email' id='email' value='<?php echo $formproc->SafeDisplay('email') ?>' maxlength="50" /><br/>
<span id='contactus_email_errorloc' class='error'></span>
</div>
<div class='container2'>
<label for='phone' >Phone Number*:</label><br/>
<input type='text2' name='phone' id='phone' value='<?php echo $formproc->SafeDisplay('phone') ?>' maxlength="15" /><br/>
<span id='contactus_phone_errorloc' class='error'></span>
</div>
<div class='container2'>
<label for='company' >Company Name: </label><br/>
<input type='text2' name='company' id='company' value='<?php echo $formproc->SafeDisplay('company') ?>' maxlength="50" /><br/>
<span id='contactus_company_errorloc' class='error'></span>
</div>
<div class='container2'>
<label for='Product_type' >Regarding:</label><br/>
<select name='Product_type'>
    <option>Business Cards</option>
    <option>Brochures</option>
    <option>Flyers</option>
    <option>Signage</option>
    <option>Banners</option>
    <option>Business Stationary</option>
    <option>Personal Stationary</option>
    <option>Posters</option>
    <option>Tickets</option>
    <option>Invitations</option>
    <option>Funeral Programs</option>
    <option>Announcements</option>
    <option>Program Booklets</option>
    <option>Magnets</option>
    <option>Postcards</option>
    <option>Name Tags</option>
    <option>Mailers</option>
    <option>Sell Sheets</option>
    <option>Pocket Folders</option>
    <option>Door Hangers</option>
    <option>Coupons</option>
    <option>Conference Book</option>
    <option>Calendars</option>
    <option>Labels</option>
    <option>Stickers</option>
    <option>Menus</option>
    <option>Decals</option>
</select>
<span id='contactus_email_errorloc' class='error'></span>
</div>
<div class='container2'>
<label for='paper_type' >Paper Type:</label><br/>
<select name='paper_type'>
    <option>Cover</option>
    <option>Text Weight</option>
</select>
<span id='contactus_email_errorloc' class='error'></span>
</div>
<div class='container2'>
<label for='finish_type' >Finish:</label><br/>
<select name='finish_type'>
    <option>Uncoated</option>
    <option>Matte</option>
    <option>Gloss</option>
</select>
<span id='contactus_email_errorloc' class='error'></span>
</div>
<div class='container2'>
<label for='quantity' >Quantity: </label><br/>
<input type='text2' name='quantity' id='quantity' value='<?php echo $formproc->SafeDisplay('quantity') ?>' maxlength="50" /><br/>
<span id='contactus_quantity_errorloc' class='error'></span>
</div>
<div class='container2'>
<label for='photo' >Your File:</label><br/>
<input type="file" name='photo' id='photo' /><br/>
<span id='contactus_photo_errorloc' class='error'></span>
</div>
<div class='container2'>
<label for='message' >Message:</label><br/>
<span id='contactus_message_errorloc' class='error'></span>
<textarea rows="10" cols="50" name='message' id='message'><?php echo $formproc->SafeDisplay('message') ?></textarea>
</div>
<!--<div class='container2'>
<label for='photo2' >Your File:</label><br/>
<input type="file" name='photo2' id='photo2' /><br/>
<span id='contactus_photo_errorloc' class='error'></span>
</div>-->
<div class='container2'>
<div><img alt='Captcha image' src='show-captcha.php?rand=1' id='scaptcha_img' /></div>
<label for='scaptcha' >Enter the code above here:</label>
<input type='text2' name='scaptcha' id='scaptcha' maxlength="10" /><br/>
<span id='contactus_scaptcha_errorloc' class='error'></span>
<div class='short_explanation'>Can't read the image?
<a href='javascript: refresh_captcha_img();'>Click here to refresh</a>.</div>
</div>


<div class='container2'>
<input type='submit' name='Submit' value='Submit' />
</div>

</fieldset>
</form>
我不知道是什么限制了表单正常工作,但我还添加了一个ini_集(“内存限制”,“250M”)


[我还附加了一个指向该页面的链接,以便您可以亲自查看表单的功能。

20000 mb…20 Gig?O_________________________________您只允许80kb的上传限制?是的,这不等于80mb吗?您需要更改php.ini中的最大帖子大小以及最大文件上传大小。如上所述,在“ValidateFileSize”中不需要除以80000,如果有任何东西被1024除。或者根本不除法。@user7436497你写了20000 MB,在英语中这意味着20 GB,你可能想写20 MB,而不是20000 MB。这就是他说的
        //file upload validations
    if(!empty($this->fileupload_fields))
    {
     if(!$this->ValidateFileUploads())
     {
        $ret = false;
     }
    }
    return $ret;
}

function ValidateFileType($field_name,$valid_filetypes)
{
    $ret=true;
    $info = pathinfo($_FILES[$field_name]['name']);
    $extn = $info['extension'];
    $extn = strtolower($extn);

    $arr_valid_filetypes= explode(',',$valid_filetypes);
    if(!in_array($extn,$arr_valid_filetypes))
    {
        $this->add_error("Valid file types are: $valid_filetypes");
        $ret=false;
    }
    return $ret;
}

function ValidateFileSize($field_name,$max_size)
{
    $size_of_uploaded_file =
            $_FILES[$field_name]["size"]/80000;//size in KBs
    if($size_of_uploaded_file > $max_size)
    {
        $this->add_error("The file is too big. File size should be less than $max_size KB");
        return false;
    }
    return true;
}

function IsFileUploaded($field_name)
{
    if(empty($_FILES[$field_name]['name']))
    {
        return false;
    }
    if(!is_uploaded_file($_FILES[$field_name]['tmp_name']))
    {
        return false;
    }
    return true;
}
function ValidateFileUploads()
{
    $ret=true;
    foreach($this->fileupload_fields as $upld_field)
    {
        $field_name = $upld_field["name"];

        $valid_filetypes = $upld_field["file_types"];

        if(!$this->IsFileUploaded($field_name))
        {
            continue;
        }

        if($_FILES[$field_name]["error"] != 0)
        {
            $this->add_error("Error in file upload; Error code:".$_FILES[$field_name]["error"]);
            $ret=false;
        }

        if(!empty($valid_filetypes) &&
         !$this->ValidateFileType($field_name,$valid_filetypes))
        {
            $ret=false;
        }

        if(!empty($upld_field["maxsize"]) &&
        $upld_field["maxsize"]>0)
        {
            if(!$this->ValidateFileSize($field_name,$upld_field["maxsize"]))
            {
                $ret=false;
            }
        }

    }