$ _file在PHP中为什么不起作用?

例外情况

我是PHP的新手,我用PHP编写了一个简单的代码用于文件上传。但是我的代码给我一个错误。有人可以帮我找到错误吗?这里是我的代码
错误给出的未定义索引

<?php

$name=$_FILES["file"]["name"];
$size=$_FILES['file']['size'];
$type=$_FILES['file']['type'];

?>

<form  action="unset.php"method="POST">
<input type="file" name="file"><br><br>
<input type="submit" value="submit">



</form>
德克·杜安·匡(Duc Doan Quang)

试试这个:PHP

<?php
if(isset($_POST['submit'])){
    echo $name=$_FILES["file"]["name"];
    echo $size=$_FILES['file']['size'];
    echo $type=$_FILES['file']['type'];
}

?>

的HTML

<form  action="unset.php" method="POST" enctype="multipart/form-data">
    <input type="file" name="file"><br><br>
    <input type="submit" name="submit" value="submit">
</form>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

在PHP中为什么不起作用

为什么XPath count()在PHP中对我不起作用?

为什么我的Date create在php中不起作用?

为什么在 jsfiddle 中循环 php 不起作用?

为什么功能链在PHP中不起作用?

为什么函数__construct在PHP中不起作用?

PHP 中的会话不起作用。为什么?

为什么PHP不起作用

为什么此CURL在PHP中起作用但在shell中不起作用

为什么“ for”在“ go”中不起作用?

为什么“setOnClickListener (this)”在“for in”中不起作用?

为什么当查询本身起作用时,php脚本中的该查询不起作用?

为什么[IO.File] :: GetAttributes(“ File.Dat”)在Powershell中不起作用

为什么不起作用?

为什么auto_prepend_file在php的交互模式下不起作用?

为什么method ='curl'在R中的download.file中不起作用?

为什么我的 ftp 连接在 php laravel 中不起作用,但在 FileZilla 中起作用?

为什么我在函数中的正则表达式在 PHP 中不起作用?

为什么我的 ajax 查询不起作用,但如果我将数据直接放在 php 代码中它会起作用?

为什么Cat 0> file不起作用

为什么data-ng-file-select不起作用?

为什么命令“ ls | file”不起作用?

为什么$(<file.txt)在makefile上不起作用?

为什么file.delete()不起作用?

为什么move_uploaded_file方法在WordPress中不起作用?

如何调试为什么file_get_contents()中的HTTP提取不起作用

为什么这段代码中的file_exits不起作用?

为什么“cat >> file”在带有粘贴文本的 zsh 中不起作用?

为什么这段 PHP 代码不起作用?