duanmei1930 2016-11-25 09:55
浏览 38

文件上传后的codeigniter重定向

1) situation: On some page the user can use an file upload form to upload a text (or excel) file. After successful upload the user should be redirected to a page where he can do whatever with his file.

2) My controller class:

...
if (!$this->upload->do_upload('fileupload')) {
            echo "error file upload not successfull";
   }else {
       redirect('import/filepreview/');
   }

3) what happens

First nothing appears to happen. The file has been uploaded but the page doesn't change. While using firebug extension it appears there has been sent a Header containing a get request to the proper target url and all the expected content is in the answer. But not displaying on site.

I actually don't know what I am doing wrong.

  • 写回答

1条回答 默认 最新

  • douxun2018 2016-11-30 15:59
    关注

    Solved the problem but only using a workaround. Finally I used javascript redirection

    window.location.replace("http://new.../x_id");

    with an x_id which the servers answer to the file upload.

    So everything works fine for me. But the original question, why CI's redirect does not work is still open for me.

    评论

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类