异步上传中数据库写入问题
本帖最后由 davidx 于 2011-7-6 00:29 编辑各位大牛:
小弟遇到一个问题。有一个表单,有文件和其它信息,如下示例
<input id="file_resume" name="file_resume" type="file" /><label for="title">*标题:</label><input name="title" id="title" type="text" value="简历"/>
其中file 上传用jquery控件异步上传,我用一个upload控制器的方法getfile来接受上传的文件,并记录其路径。上传后要把路径信息写入数据库,但要和标题信息一起提交给方法do后再写,这样我用一个类成员resumepath来记录。
class Upload extends CI_Controller {
private $_resumepath;
public function __construct(){
parent::__construct();
}
public function getfile(){
……
$this->_resumepath=$filepath;
……
}
public function do(){
……
将$this->_resumepath写入数据库;
……
}
但是我在do中得到的$this->_resumepath为空。请问一下为什么getfile中$this->_resumepath的值不能传递到do中呢?各位是如何解决类似的问题的?
问题解决了,汗啊!我用一个hidden字段来存放路径,直接接受post的值。原先却把hidden字段放在form外面了。怪不得接收不到。
页:
[1]