You are here: Re: can one set post_max_size in form? « PHP Programming Language « IT news, forums, messages
Re: can one set post_max_size in form?

Posted by petersprc on 12/16/24 11:58

If you're using Apache, you can try setting LimitRequestBody to the
desired limit in bytes. For example: "LimitRequestBody 100000". This is
available in .htaccess as well as the global configuration. See
http://httpd.apache.org/docs/1.3/mod/core.html#limitrequestbody

You can also try setting PHP's post_max_size directive in apache if
php.ini is off-limits. For example: "php_value post_max_size 100000".
See http://us3.php.net/manual/en/ini.core.php#ini.post-max-size

Another option is to use client-side browser validation. You can set
the maxlength attribute on a text field or use javascript to check the
length of a textarea before submitting. These limits could be bypassed
by a user determined to do so however. An example of client-side input
length checking:

<script type="text/javascript">
<!--
// Don't allow more than length chars
function checkTextareaLen(textarea, length)
{
if (textarea.value.length > length) {
textarea.value = textarea.value.substring(0, length)
}
}
//-->
</script>

<form method=post>

<input name=text1 maxlength=5> <!-- Browser should limit text1 to 5
chars -->

<textarea name=text2
onKeyDown="checkTextareaLen(this, 20)"
onKeyUp="checkTextareaLen(this, 20)"
onChange="checkTextareaLen(this, 20)"
></textarea>

<input type=submit>

</form>

See here for a more advanced script that allows you to set maxlength on
textarea elements: http://www.quirksmode.org/dom/maxlength.html

Best Regards,

John Peters

veg_all@yahoo.com wrote:
> I dont have access to my php.ini file so I am trying the following
> which doesn't seem to work:
>
> <input type=hidden name=post_max_size value=100000>
>
> I know it can be done for file uploads, but can it be done for posting
> data?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация