gpt4 book ai didi

php - $_FILES 不工作?

转载 作者:太空狗 更新时间:2023-10-29 14:39:11 25 4
gpt4 key购买 nike

我通过这种方式在表单内提交文件(带有提交按钮、表单标签等):

<fieldset>
<input type="file" name="file" />
</fieldset>

我正在尝试以这种方式将其与 PHP 一起使用:

$file = $orgname."/".basename($_FILES['file']['name']);
move_uploaded_file($_FILES['file']['tmp_name'], $file);

我收到了这些错误:

Notice: Undefined index: file in C:\wamp\www\generic\addorg.php on line 45

Notice: Undefined index: file in C:\wamp\www\generic\addorg.php on line 46

这可能是什么原因造成的?我调查过的所有内容都表明它应该有效。

最佳答案

需要设置表单enctype=multipart/form-data

关于php - $_FILES 不工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8246569/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com