- <?php
- print_r($_FILES);
- function MAX_FILE_SIZE($k=NULL){
- $tmp = 1024*1024*min(ini_get('memory_limit'), ini_get('post_max_size'), ini_get('upload_max_filesize'));
- if(is_null($k)) {
- return $tmp;
- }else{
- return min($tmp, 1024*$k);
- }
- }
- ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <style type="text/css">
- <!--
- * {
- margin: 0px;
- font-size: 12px;
- }
- -->
- </style>
- </head>
- <body>
- <form action="?" method="post" enctype="multipart/form-data">
- <input type="hidden" name="MAX_FILE_SIZE" value="<?=MAX_FILE_SIZE()?>" />
- <input type="file" name="img" id="img" />
- <input type="submit" value="上传" />
- </form>
- </body>
- </html>
PHP上传MAX_FILE_SIZE相关
最新推荐文章于 2023-05-06 15:28:04 发布