我在PHP中使用jQuery文件上传。它在我的本地服务器上正常运行,但在实时服务器上不起作用

时间:2016-02-20 13:10:48

标签: jquery codeigniter

控制器Welcome.php文件中的我的PHP代码:

function uploader(){

     $options = array(
       'upload_dir' => 'uploads/', 
       'upload_url' => base_url().'uploads/',   
       'script_url' => base_url().'Welcome/uploader',     
       //'parameter'  => 'uploads'
    ); 
    $upload_handler = new UploadHandler($options);

 }

这是我的javascript代码:

$(function () {
'use strict';  

// Initialize the jQuery File Upload widget:
$('#fileupload').fileupload({
    // Uncomment the following to send cross-domain cookies:
    //xhrFields: {withCredentials: true},
    url: '<?php echo base_url();?>Welcome/uploader'     
});

// Enable iframe cross-domain access via redirect option:
$('#fileupload').fileupload(
    'option',
    'redirect',
    window.location.href.replace(
        /\/[^\/]*$/,
        '/cors/result.html?%s'
    )
)
})

0 个答案:

没有答案