[eluser]CollinsSolutions[/eluser]
Code:
$user_id = $this->uri->segment(3);
//print('User ID:'.$user_id);
$upload_name = 'Filedata';
//print_r($_FILES);
//echo $count;
//log_message('info', 'Just inside loop');
$fileName = $_FILES[$upload_name]['name'];
//echo 'Name is: ' . $fileName . '<BR>';
//log_message('info', $this->dx_auth->get_user_id());
$file = array(
'name' => addslashes($fileName),
'type' => $_FILES[$upload_name]['type'],
'size' => $_FILES[$upload_name]['size'],
'user_id' => $user_id);
$tmpName = $_FILES[$upload_name]['tmp_name'];
$content = read_file($tmpName);
$content = addslashes($content);
$file['content'] = $content;
$this->db->insert('files', $file);
I was inserting into a database so the code was less than uploading. And i used the following for the swf code
Code:
var swfu;
window.onload = function() {
var settings = {
flash_url : "<?=$url?>flash/swfupload.swf",
upload_url: "<?=$site_url?>/manage/do_upload/<?=$this->dx_auth->get_user_id()?>", // Relative to the SWF file
post_params: {"PHPSESSID" : "<?=$this->session->userdata('session_id')?>"},
file_size_limit : "100 MB",
file_types : "*.pdf",
file_types_description : "Only PDF",
file_upload_limit : 100,
file_queue_limit : 0,
custom_settings : {
progressTarget : "fsUploadProgress",
cancelButtonId : "btnCancel"
},
debug: false,
// Button settings
button_image_url: "<?=$url?>images/TestImageNoText_65x29.png", // Relative to the Flash file
button_width: "65",
button_height: "29",
button_placeholder_id: "spanButtonPlaceHolder",
button_text: '<span class="theFont">Browse</span>',
button_text_style: ".theFont { font-size: 16; }",
button_text_left_padding: 6,
button_text_top_padding: 3,
// The event handler functions are defined in handlers.js
file_queued_handler : fileQueued,
file_queue_error_handler : fileQueueError,
file_dialog_complete_handler : fileDialogComplete,
upload_start_handler : uploadStart,
upload_progress_handler : uploadProgress,
upload_error_handler : uploadError,
upload_success_handler : uploadSuccess,
upload_complete_handler : uploadComplete,
queue_complete_handler : queueComplete // Queue plugin event
};
swfu = new SWFUpload(settings);
};