上传文件时出现问题 [英] problem when uploading file
问题描述
我有表格,我想上传两个文件。
这里是脚本
< form action =form.phpmethod =postenctype = multipart / form-data/>
< input type =filename =video/>
< input type =filename =picture>
< input type =submitclass =inputvalue =շիշել/>
< input type =hiddenname =MAX_FILE_SIZEvalue =100000000/>
< / form>
form.php:
<?
print_r($ _ FILES);
$ video_name = $ _FILES [video] [name];
$ image_name = $ _FILES [picture] [name];
echovideo,$ video_name;
echoimage,$ image_name;
//返回Array()videoimage
?>
当我尝试上传大于 10MB 的文件时,不会发生。我尝试了很多浏览器。
也许我必须在php.ini中更改一些字段?但我没有权限在服务器上更改它们。所以我能做什么?
thanks
文件上传 - 常见陷阱 $ b
MAX_FILE_SIZE项目无法指定
a文件大小大于php.ini
文件中$ b $ upload_max_filesize中设置的文件大小
。默认值为2兆字节。
如果启用了内存限制,则可能需要更大的
memory_limit。确保
设置的memory_limit足够大。
...
如果post_max_size设置得太小,则无法上传
大文件。让
确保你设置post_max_size大
就足够了。
你可以增加MAX_FILE_SIZE 的值四种方式:
1)php.ini
upload_max_filesize = 20M
post_max_size = 20M
2)ini_set()
ini_set('upload_max_filesize',20M);
ini_set('post_max_size',20M);
<3> .htaccess
php_value upload_max_filesize 20M
php_value post_max_size 20M
4)隐藏表单字段
< input name =MAX_FILE_SIZEvalue =20971520type =hidden>
i have the form, and i want to upload two files. here is the script
<form action="form.php" method="post" enctype="multipart/form-data" />
<input type="file" name="video" />
<input type="file" name="picture" >
<input type="submit" class="input" value="Հիշել" />
<input type="hidden" name="MAX_FILE_SIZE" value="100000000" />
</form>
form.php:
<?
print_r($_FILES);
$video_name = $_FILES["video"]["name"];
$image_name = $_FILES["picture"]["name"];
echo "video",$video_name;
echo "image",$image_name;
//returns Array ( ) videoimage
?>
when i try to upload the file greater than 10MB, it doesn't happen. i try in many browsers. maybe i must change some field in php.ini? but i haven't permission to change them on the server. so what can i do? thanks
File Uploads - Common Pitfalls
The MAX_FILE_SIZE item cannot specify a file size greater than the file size that has been set in the upload_max_filesize in the php.ini file. The default is 2 megabytes.
If a memory limit is enabled, a larger memory_limit may be needed. Make sure you set memory_limit large enough.
...
If post_max_size is set too small, large files cannot be uploaded. Make sure you set post_max_size large enough.
You can increase the value for MAX_FILE_SIZE three four ways:
1) php.ini
upload_max_filesize = 20M
post_max_size = 20M
2) ini_set()
ini_set('upload_max_filesize', 20M);
ini_set('post_max_size', 20M);
3) .htaccess
php_value upload_max_filesize 20M
php_value post_max_size 20M
4) hidden form fields
<input name="MAX_FILE_SIZE" value="20971520" type="hidden">
这篇关于上传文件时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!