Home > Backend Development > PHP Tutorial > laravel5.2,上传文件失败

laravel5.2,上传文件失败

WBOY
Release: 2016-06-06 20:11:37
Original
1042 people have browsed it

1.

<code class="PHP">if($request->hasFile('photo')){
    $request->file('photo')->move('upload');
}</code>
Copy after login
Copy after login

代码很简单,就是官方文档的推荐用法,在本地测试可以正常使用,但是在服务器测试的时候会卡在$request->hasFile()这个地方,
服务器环境是lnmp1.2的,
这是因为我哪个地方的权限没有设置好吗?
public/upload已经给了777权限,

回复内容:

1.

<code class="PHP">if($request->hasFile('photo')){
    $request->file('photo')->move('upload');
}</code>
Copy after login
Copy after login

代码很简单,就是官方文档的推荐用法,在本地测试可以正常使用,但是在服务器测试的时候会卡在$request->hasFile()这个地方,
服务器环境是lnmp1.2的,
这是因为我哪个地方的权限没有设置好吗?
public/upload已经给了777权限,

仔细看文档

<code>$file->move($uploadDir, $file_name);</code>
Copy after login

也许是文件大小超出服务器限制,看看服务器apache的配置:file_upload_size( upload_file_size ?我忘了),还有post_max_size

贴下报错的提示

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template