在本地主机上上传图像时获取UPLOAD_ERR_PARTIAL [英] Getting UPLOAD_ERR_PARTIAL when uploading images on localhost

查看:52
本文介绍了在本地主机上上传图像时获取UPLOAD_ERR_PARTIAL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个简单的html表单上载图像,然后将其保存在本地主机上的目录中.

I'm working on a simple html form to upload an image, then save it on a directory situated on my localhost.

<form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>" enctype="multipart/form-data" method="post">
<label for="img">Pick a picture</label>
<input id="img" type="file" name="image">
<input type="submit" name="imageProfil" value="Upload the image">
</form>

但是,当我处理图像时,在检查错误(在$ _FILES ['image'] ['errors']中)时,出现错误3,表示文件仅部分上传.

However, when I handle the image, while checking errors (in $_FILES['image']['errors'], I'm getting an error 3, which means the file has only been partially uploaded.

此外,每次我上传文件时,在第一个响应(向我抛出异常的地方)之后我都没有得到任何响应.我已经完成了所有错误检查,确实在表单上放置了enctype ="multipart/form-data",基本上我一无所知.

Moreover, each time I upload a file, I'm not getting any response after the first response (where the exception is thrown at me). I've done all the error checking, I did put the enctype="multipart/form-data" on my form, and I'm basically clueless right here.

谢谢您的时间.

推荐答案

您必须检查php.ini文件上的PHP配置.如果您的上传不断被中断,那么您要么需要增加最大上传大小,要么需要增加PHP脚本超时的时间.检查以下变量:

You have to check your PHP configurations on php.ini file. If your upload is constantly being interrupted you either need to increase the maximum upload size or the time before your PHP script times out. Check this variables:

post_max_size
upload_max_filesize
max_execution_time

您可以使用ini_set函数增加PHP配置文件或增加脚本.有关更多详细信息,请查阅手册.PHP手册

You can either increase in your PHP configuration file or increase in your script using the ini_set function. Check the manual for more details. PHP Manual

这篇关于在本地主机上上传图像时获取UPLOAD_ERR_PARTIAL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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