Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/250.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP7.2上的问题解决移动上载文件错误8-上载错误扩展名_Php_File_Php 7.2 - Fatal编程技术网

PHP7.2上的问题解决移动上载文件错误8-上载错误扩展名

PHP7.2上的问题解决移动上载文件错误8-上载错误扩展名,php,file,php-7.2,Php,File,Php 7.2,我发布了一个来自html5表单和PHP的文件,希望将电影放到某个目录中。 Move_UPLOAD_file抛出错误8,表示非特定的上载错误扩展名 Ubuntu服务器运行的是PHP7.2,没有Suhosin扩展。 我已经检查了apacheerror.log文件,但没有找到任何与操作相关的条目 在我改为move_uploaded_file之前,我正在处理copy命令copy(…),它也抛出了一个错误,因此我了解到move_uploaded_file是首选的方法 我目前的检查结果: print_r($

我发布了一个来自html5表单和PHP的文件,希望将电影放到某个目录中。 Move_UPLOAD_file抛出错误8,表示非特定的上载错误扩展名

Ubuntu服务器运行的是PHP7.2,没有Suhosin扩展。 我已经检查了apacheerror.log文件,但没有找到任何与操作相关的条目

在我改为move_uploaded_file之前,我正在处理copy命令copy(…),它也抛出了一个错误,因此我了解到move_uploaded_file是首选的方法

我目前的检查结果:

print_r($_FILES);
Array ( [customFile] => Array ( [name] => Array ( [0] => Logo 011.jpg ) [type] => Array ( [0] => image/jpeg ) [tmp_name] => Array ( [0] => /tmp/phpJVODjF ) [error] => Array ( [0] => 0 ) [size] => Array ( [0] => 210813 ) ) )
该文件应移动到: /主页/csitestore/images/25

此目录的权限为777,因此每个人都可以完全访问,以确保这不是问题:
DRWXRWX 2 www数据www数据4096 Okt 4 09:15 25

PHP.ini说:

post_max_size = 99M
file_uploads = On
upload_max_filesize = 99M
max_file_uploads = 20
max_execution_time = 90
max_input_time = 90
memory_limit = 512M
但是我试图上传的文件只有210kB,所以我认为这些限制并没有起到任何作用

如何获得错误“UPLOAD\u ERR\u EXTENSION”的更具体描述?或者我如何继续解决它

html文件中的“我的表单”标记:


send_data.php中用于上载和移动文件的代码:

if(!is_dir(“/home/csitestore/images/25”)){
if(!@mkdir(“/home/csitestore/images/25”)){
$error=error_get_last();
echo$error['message'];
}否则{
chmod(“/home/csitestore/images/25”,0777);
}
}
$path=“/home/csitestore/images/25/test.jpg”;
如果(!move_uploaded_file($_FILES['customFile']['tmp_name'][0],$path))-->[0],因为我通常在循环中使用它,但我只尝试使用一个文件
{
$errors=error_get_last();
echo“Error:.$errors['type'];=8=>UPLOAD\u ERR\u扩展名
回显“
\n”。$errors['message']; }

我现在真的不知道如何继续。

我认为你这里的错误实际上不是上传错误。根据手册,这种情况发生在“PHP扩展停止文件上载”时,但这种情况已经发生在上载阶段,并且会反映在$\u文件中的
错误
条目中。但是根据您自己的调试输出,您得到了
[error]=>Array([0]=>0)
,因此在上传阶段没有错误。以后你可能会得到一个数字错误代码8,但那与上传错误扩展无关。这才是真正让我吃惊的。在移动上传的文件后,我通过键入echo“error:”.$errors['type']捕捉错误;我真的不知道错误是从哪里来的。最新的操作是移动文件。捕捉到的错误是数字8。所以我把这个和move_上传的文件联系起来。也许我知道发生了什么。正在检查$_FILES['customFile']['tmp_name'][0]中的文件名,我得到“/tmp/phpJQlYHu”。那么上传的文件应该显示在ubuntu tmp目录中,对吗?但事实并非如此。我注释了move_upload_file out,这样上传的文件应该放在temp dir中,但是没有任何内容。我现在想到的另一个事实是,我编写了另一个上传脚本,它也不再使用“copy”命令工作。我一周前升级了apt。也许就是这样?tmp目录的权限:
drwxrwxrwt 10根根目录4096 Okt 6 12:09 tmp
OK已解决。问题是samba中的错误配置。