在php中上传大文件 [英] upload large file in php

查看:65
本文介绍了在php中上传大文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在PHP中上传大于2MB的文件,我在Internet上搜索并更改了php.ini文件,其行是:"upload_max_filesize = 200M",但我什至不能上传2 MB的文件.

How can I upload files larger than 2MB in PHP,I searched the Internet and i changed the php.ini file,the line is: "upload_max_filesize = 200M",but I still can't upload even 2 MB file.

似乎是什么问题?

请帮助我.谢谢.

推荐答案

从前,我遇到了WAMP服务器的这个问题,当我寻找解决方案时,我偶然发现了这个讨论.因此,如果有人遇到相同的问题,这是我的工作解决方案,希望能对您有所帮助:

Once upon a time I'm facing this problem with my WAMP server, and when I search for solution, I stumbled upon to this discussion. So, if someone have the same problem, this is my working solution, I hope this help:

  1. 我正在使用WAMP堆栈.通过阅读上面的评论,您也正在使用WAMP堆栈.如果您不知道,WAMP服务器具有2(两个)php.ini(在PHP目录和Apache目录中)配置,一个配置用于CLI,另一个配置用于Apache本身(请参阅我的WAMP网页使用哪个PHP Ini文件?).

  1. I'm using WAMP stack. By reading your comment above, you are using WAMP stack too. In case you don't know, WAMP server has 2 (two) php.ini (in PHP directory and Apache directory) configuration, one for CLI and the other for Apache itself ( see php.ini on WAMP server ). So, I create info.php to detect which php.ini use by my server, and in my case that is the one in Apache directory ( see Which PHP Ini file does my WAMP webpage uses?).

打开服务器使用的php.ini ,然后按照@Pascal Martin的建议,更改upload_max_filesize并同时设置post_max_size然后重新启动您的服务器.

Open your php.ini that used by your server, and as @Pascal Martin suggested, change upload_max_filesizeand also set post_max_size then restart your server.

再次检查您的info.php,确保upload_max_filesizepost_max_size的值已更改为所需的值.

Check again your info.php, make sure the value of upload_max_filesize and post_max_size has changed to your desired value.

重新启动Apache.

Restart Apache.

对我有用,希望得到帮助.

It's worked for me, hope this help.

这篇关于在php中上传大文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆