简体   繁体   English

未定义的索引:第21行的C:\\ wamp \\ www \\ netupdate.php中的图像

[英]Undefined index: image in C:\wamp\www\netupdate.php on line 21

I am facing some weird problem. 我面临一些奇怪的问题。 Here is my file upload snipped of the form through which I am trying to upload the image to my server 这是我试图将图像上传到服务器的表格的文件上传片段

<input type="file" name="image" id="image">

And I am getting the error: 而且我得到了错误:

Undefined index: image in C:\wamp\www\netupdate.php on line 21

My upload script is as following 我的上传脚本如下

// file upload scrpt 
  $name= $_FILES['image']['name'];
  $tmp_name = $_FILES['image']['tmp_name']; 
  $type = $_FILES['image']['type']; 
  $size = $_FILES['image']['size'];
  $pathAndName = "file:///c:/wamp/www/upload/networking/".$name;
  $moveResult = move_uploaded_file($tmp_name, $pathAndName);

Now the weird portion is that all other parameters are being accepted in the php script other than the image, I am writing everything to my database and its giving a success message but only this portion is giving errors and even weirder part is that a similar script is working perfectly in other mysql table so I guess there is nothing wrong in php_ini. 现在,怪异的部分是除图像以外的其他所有参数都在php脚本中被接受,我正在将所有内容写入数据库,并给出了成功消息,但是只有这一部分给出了错误,甚至更怪异的部分是类似的脚本在其他mysql表中运行良好,所以我猜php_ini中没有错误。

您可能在<form>元素上缺少enctype="multipart/form-data"

<form action="netupdate.php" method="post" enctype="multipart/form-data">

确保您的表单标签上有enctype="multipart/form-data"

<form id="xx" name="xxx" action="xxx.php" method="post" enctype="multipart/form-data">

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 注意:未定义的索引:第21行的D:\\ wamp \\ www \\ onlinesShop \\ newitem.php中的图像 - Notice: Undefined index: image in D:\wamp\www\onlinesShop\newitem.php on line 21 未定义索引:第 4 行 C:\wamp\www\emailvalidate.php 中的电子邮件 - Undefined index: email in C:\wamp\www\emailvalidate.php on line 4 未定义索引:在第 4 行输入 C:\\wamp\\www\\submit.php - Undefined index: type in C:\wamp\www\submit.php on line 4 注意:未定义的索引:第63行的C:\\ wamp \\ www \\ chatsystem \\ index.php中的名称 - Notice: Undefined index: name in C:\wamp\www\chatsystem\index.php on line 63 注意:未定义的索引:在第37行的C:\\ wamp \\ www \\ tests \\ Joomla \\ Website \\ index.php中 - Notice: Undefined index: in C:\wamp\www\tests\Joomla\Website\index.php on line 37 注意:未定义的索引:第46行的C:\\ wamp \\ www \\ upload.php中的fileToUpload - Notice: Undefined index: fileToUpload in C:\wamp\www\upload.php on line 46 注意:未定义的索引:第164行的C:\\ wamp \\ www \\ blog \\ news.php中的pre - Notice: Undefined index: pre in C:\wamp\www\blog\news.php on line 164 注意:未定义的变量:第7行的C:\\ wamp \\ www \\ cbmall \\ index.php中的db_host - Notice: Undefined variable: db_host in C:\wamp\www\cbmall\index.php on line 7 我有错误:注意:未定义偏移量:C:\\ wamp \\ www \\ index.php在32行,34行,36行,38行的C:\\ wamp \\ www \\ index.php中 - I have error:Notice: Undefined offset: 1 in C:\wamp\www\index.php on line 32,on line 34,on line 36,on line 38 PHP错误提示:未定义的索引:第35行的C:\\ wamp \\ www \\ tweetball \\ classes \\ word.class.php中的UserID - Php error Notice: Undefined index: UserID in C:\wamp\www\tweetball\classes\word.class.php on line 35
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM