$\u文件在php中不起作用
我想上传图像,但有这样一个错误 注意:未定义索引:第12行/xxx/xxxx/xxxxx/xxxx/add-currency.php中的img 代码在这里$\u文件在php中不起作用,php,html,Php,Html,我想上传图像,但有这样一个错误 注意:未定义索引:第12行/xxx/xxxx/xxxxx/xxxx/add-currency.php中的img 代码在这里 if(isset($_POST['submit'])) { $logo = $_FILES["img"]["name"]; $logo_tmp = $_FILES["img"]["tmp_name"]; $file_path = "images/".$logo; move_uploaded_file($log
if(isset($_POST['submit'])) {
$logo = $_FILES["img"]["name"];
$logo_tmp = $_FILES["img"]["tmp_name"];
$file_path = "images/".$logo;
move_uploaded_file($logo_tmp, $file_path);
}
和html代码id
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data">
<div class="row clearfix">
<div class="col-sm-6">
<label>Logo</label><br>
<input type="file" name="img" />
</div>
</div>
<br>
<div class="row clearfix">
<div class="col-sm-12">
<button name="submit" class="btn m-btn--pill m-btn--air btn-primary" type="submit" style="float:right;">Submit</button>
</div>
</div>
</form>
您的代码是正确的,在我这边运行良好。无论您得到什么,都不是错误,而是不影响功能的通知
Notice: Undefined index: img in /xxx/xxxx/xxxxx/xxxxx/xxxx/add-currency.php on line 12
这可能是因为您在定义img之前使用了img。即使没有错误,您的代码也可以正常工作。这只是一个通知。好吧,您的代码允许我上传任何我想要的特洛伊木马:)嗯?你对此感到高兴吗?@bub可能是特洛伊木马上传平台,你永远不知道;):p@teeyo你肯定是我的一天…..)他只是问他收到的通知,而不是他想上传什么。这是他的决定,他有相应的代码。有$_POST['img']是完整的工作,但不是$_文件['img']['name']工作过的$_文件['img][“name”];他在我这边工作。这是我上传的打印图像名称。你们能粘贴完整的代码,这样我就可以知道错误了。