Php 带有锚标记的CodeIgniter文件上载问题
下面是我用来上传Php 带有锚标记的CodeIgniter文件上载问题,php,html,codeigniter,Php,Html,Codeigniter,下面是我用来上传CodeIgniter文件的一段代码。这很好,但我想通过单击带有图像的锚定标记来上传文件。请告诉我怎么做 代码: 1) 为表单指定一个id为id=“fileForm” 2) 在上添加一个js事件,只需添加一点javaScript就可以了 <form enctype="multipart/form-data"> <input type='file' name='userfile' id="userfile" style="display:
CodeIgniter
文件的一段代码。这很好,但我想通过单击带有图像的锚定标记来上传文件。请告诉我怎么做
代码:
1) 为表单指定一个id为id=“fileForm”
2) 在上添加一个js事件,只需添加一点javaScript就可以了
<form enctype="multipart/form-data">
<input type='file' name='userfile' id="userfile" style="display: none;">
<a href="#" onclick="document.getElementById('userfile').click(); "><img src="https://png.icons8.com/metro/1600/settings.png" style="height: 100px;"></a>
<input type = 'submit' value = 'upload' />
</form>
检查此项首先填写表单标签,是否尝试此项?
function submitForm(){
$("#fileForm").submit();
<form enctype="multipart/form-data">
<input type='file' name='userfile' id="userfile" style="display: none;">
<a href="#" onclick="document.getElementById('userfile').click(); "><img src="https://png.icons8.com/metro/1600/settings.png" style="height: 100px;"></a>
<input type = 'submit' value = 'upload' />
</form>