控制器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'
)
)
})