dourong4031 2015-03-10 08:06
浏览 36

php codeigniter上传文件错误

this is my controller function and below is my view file code pleas help to find out the error in my code

defined('BASEPATH') OR exit('No direct script access allowed');

class Upload extends CI_Controller {

    function __construct(){

    function test(){
            $config['upload_path'] = $_SERVER['DOCUMENT_ROOT'].'/assets/uploads/';
            $config['allowed_types'] = 'mp4';

            if ( ! $this->upload->do_upload()){
                $error = array('error' => $this->upload->display_errors());
                $data = array('upload_data' => $this->upload->data());


and this is my view code->

<form action="" method="POST" enctype="multipart/form-data" >
    Select File To Upload:<br />
    <input type="file" name="userfile"  />
    <br /><br />
    <input type="submit" name="submit" value="Upload" class="btn btn-success" />

and i m getting errors are -> enter image description here

  • 写回答

1条回答 默认 最新

  • dongpao9437 2015-03-10 15:00

    Finally i got this working,it took whole day. I was developing this on CI version->3.0 and when i replace my system folder with the new updated CI VERSION->3.0rc2 it worked like a charm in a single go and didn't change a single line in the above code.Both are development version of CI-3.But in the updated version my form validation stopped working, but as in the last version it was working fine so i copied my old version system/library/form_validation.php to new version at the same place and it is working fine now.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 如何通过交互分析得出某高危患者对放疗获益更多
  • ¥15 相关性分析中,p<0.05, r=0.29,怎么评价相关性呢
  • ¥15 docker部署Mongodb后输入命令报错?
  • ¥15 将下列流程图转变成python程序代码
  • ¥15 我需要全国每个城市的最新小区名字等数据。
  • ¥15 开发一个小区生态的小程序
  • ¥15 如何解决Excel中dependent dropdown list 的问题
  • ¥15 MddBootstrapInitialize2失败
  • ¥15 LCD Flicker
  • ¥15 esp32在micropython环境下使用ssl/tls连接mqtt服务器出现以下报错Connected on发生意外错误: 5无法连接到 MQTT 代理,如何解决?