开发者

php & CI file upload

I have a file input element which generate by ajax/jquery.load(). and when I want to move the uploaded file, I got an error that says I have no file to upload.

I tried it with CI file uploading class and php move_uploaded_files(), but it return the same error..

Here's my code with CI

开发者_Python百科
$config['upload_path'] = './'.$uploadpath.'/answer';
$config['allowed_types'] = '*';
$config['max_size'] = '2048';
$config['file_name'] = $probid.".ans";
$this->load->library('upload', $config);
if(!$this->upload->do_upload("contanswer".$i))
{
//do some error handling
}

Here's my code with php move_uploaded_files

move_uploaded_file($_FILES["continput".$i]["tmp_name"], $uploadpath.'/input');

FYI, $i is an index variable, because I've some file input element on my page..

Am I missing something in my code?? thx


try to get the full $_FILES array and check if you are getting the values right:

print_r($_FILES);

then see what values you get from the form, maybie there is some typo in the name? also check the $i variable value, maybie it starts from different value

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜