n8539 发表于 2012-11-13 21:19:40

新手求助,关于sae上上传图片

本帖最后由 n8539 于 2012-11-13 21:24 编辑

哪位大侠来帮帮我这个菜鸟,CI里面这个偏好 $config['upload_path'] = './uploads/';应该怎样修改,才能设置路径到storage。我按照http://code.google.com/p/ci-sae/里面说的可是不成功。假如我的domain是upload的话。


<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>



      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>";
          }
      }

Hex 发表于 2012-11-16 12:58:22

不成功报什么错?

n8539 发表于 2012-11-16 22:28:22

Hex 发表于 2012-11-16 12:58 static/image/common/back.gif
不成功报什么错?

The upload path does not appear to be valid.

storage应该是可读写的吧?是不是这里不适合用ci了?

谢谢管理员同志~

levin 发表于 2012-11-25 23:55:00

这个上传的目录不可写,所以上传不成功
页: [1]
查看完整版本: 新手求助,关于sae上上传图片