|
本帖最后由 n8539 于 2012-11-13 21:24 编辑
哪位大侠来帮帮我这个菜鸟,CI里面这个偏好 $config['upload_path'] = './uploads/';应该怎样修改,才能设置路径到storage。我按照http://code.google.com/p/ci-sae/里面说的可是不成功。假如我的domain是upload的话。
HTML复制代码
<div id="uploads">
<?php echo form_open_multipart('upload/do_upload', array('target' => 'hidden_frame'));?>
<input type="file" name="userfile" size="20" id="filesel" style="background-color:#B2E0FF;cursor: pointer"/>
<input type="submit" value="上传图片" style="cursor: pointer"/>
</form>
<iframe name="hidden_frame" id="hidden_frame" style="display:none"></iframe>
</div>
复制代码
PHP复制代码
public function do_upload (){
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '1500';
$config['max_width'] = '2400';
$config['max_height'] = '1800';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$error=$this->upload->display_errors();
echo "<script >window.parent.callback(0,\"$error\");</script>"; //使用iframe时限异步不刷新,伪异步????
}
else
{
$info = array('upload_data' => $this->upload->data());
$filename=$info['upload_data'] ['file_name'];
echo "<script >window.parent.callback(1,\"$filename\");</script>";
}
}
复制代码 |
|