0
我试图从选择字段获取值。但无法获得文件的价值。从输入类型获取图像名称和路径=表格
这里是代码的样子:
<div class="fileupload fileupload-new" data-provides="fileupload">
<div class="fileupload-new thumbnail" style="width:96%; height: 150px;">
<img src="<?php if(isset($page->header_image)!= ""){echo $page->header_image;} else{ echo "http://www.placehold.it/280x150/EFEFEF/AAAAAA&text=no+image";} ?>" alt="" />
</div>
<div class="fileupload-preview fileupload-exists thumbnail" style="width: 100%; max-height: 150px; line-height: 20px;"><?php if(isset($page->header_image)!= ""){ echo "<img src='{$page->header_image}' />"; } ?></div>
<div>
<span class="btn btn-file"><span class="fileupload-new">Select image</span>
<span class="fileupload-exists">Change</span>
<input type="file" class="default" name="headerimage" /></span>
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a>
</div>
</div>
,这里是我使用的PHP代码。
if(isset($_POST['submit-page'])){
echo $_FILES['headerimage']['tmp_name'];
echo $_FILES['headerimage']['name'];
}
,但它显示了以下错误:undefined index "headerimage"
他甚至没有表格.. – enapupe
它的工作。我有形式和它的魅力工作。你可以看看这个链接吗? http://stackoverflow.com/questions/21878280/event-trigger-in-javascript-and-conditional-tag我也面临着这个问题。非常感谢。 – user3201500
他没有在他的例子中包含任何表单标签,但他如何能够通过if(isset($ _ POST ['submit-page']))并且未通过$ _FILES [“headerimage”]定义失败? – gts