我使用PHP编写了一个向导,其中一个表单需要用户上传图片。
我已经完成了所有内容,唯一的问题是在我的if语句中,我必须能够判断表单是否使用jquery的submit()方法提交。
以下是使用jquery在用户选择图片后提交表单的代码。
var initUpload = function(){
$('.filebutton').change(function(e){
$("form").submit();
});
};
这是我的if语句的样子。
if($this->input->post('back')){
//Tells me that the user clicked on the back button, and to go back 1 step in the wizard.
}else if(???){
//This is where I would like to say: if form was submitted with jquery.
}else{
//Else the user just clicked "next" and to continue normally.
}
我已经知道的:
使用$this->input->post('back')
,我可以检查表单是否使用值为BACK的按钮提交。我已经var_dumped $this->input->post()
,但它只返回输入字段的值。
image
的详细信息,您需要使用var_dump($_FILES)
。 - M Khalid Junaidelse if($_FILES['userfile']['name'])
如果你回答,我会将你标记为正确答案。 - KolbyCI
库上传文件。 - M Khalid Junaid