[eluser]phpfresher[/eluser]
I have the form to upload the images, pdfs, .zip of any size but when i try to upload the file greater than 1mb , the action is not redirected to the controller. What may be the problem.
Controller function of download
Code:
function addnew_download(){
if($this->input->post('submit')){
$this->form_validation->set_rules('filename', 'Title','required');
if ($this->form_validation->run() == TRUE) {
$data['title'] = $this->input->post('filename');
$data['catid'] = $this->input->post('catid');
$data['filename_status'] = $this->input->post('filename_status');
$config['upload_path'] = './downloads/';
$config['allowed_types'] = '*';
$config['max_size'] = '256000';
$config['overwrite'] = false;
$this->load->library('upload', $config);
if(!$this->upload->do_upload()){
$this->data['errors'] = $this->upload->display_errors();
}else{
$data['filename'] = $this->upload->file_name;
$data['file_size'] = $this->upload->file_size;
$this->data['msg'] = $this->download_model->adddownload($data);
}
}
}
$this->data['downloadcategory'] = $this->download_model->viewdownloadcategory();
$this->data['template'] = 'surfadmin/download/adddownload';
$this->load->view('surfadmin/main',$this->data);
}
The Form to Upload the file
Code:
<?php echo form_open_multipart(base_url().'surfadmin/download/addnew_download'); ?>
<input type="hidden" name="filename_status" value="1" />
<div class="post_right">
<table cellspacing="0" class="wp-list-table widefat fixed posts"
<thead>
<tr>
<th class="manage-column column-cb check-column" id="cb" scope="col" colspan="7"><div class="addicon"></div><h2>Add New Download</h2></th>
</tr>
</thead>
</table>
<?php
if(isset($msg)){
?>
<table width="100%" cellpadding="0" cellspacing="0" border="1" class="FormTbl">
<tr class="TitleBarA">
<td width="100%"><?php echo $msg;?></td>
</tr>
</table>
<?php
}
?>
<table width="100%" cellpadding="0" cellspacing="0" border="1" class="FormTbl">
<tr class="TitleBarA">
<td width="100%">File Name : <input type="text" name="filename" id="filename" class="inputBox" value="" /><?php echo form_error('filename', '<span class="error">', '</span>'); ?></td>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0" border="1" class="FormTbl">
<tr class="TitleBarA">
<td width="100%" valign="top">
Choose Category :
<select name="catid">
<option value="">Select Category</option>
<?php
$allcat = count($downloadcategory);
for($i=0 ; $i<$allcat; $i++){
@$midcount = count($downloadcategory);
?>
<option value="<?php echo $downloadcategory[$i]['dcid'];?>" > <?php echo $downloadcategory[$i]['cat_name'];?></option>
<?php
}
?>
</select>
</td>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0" border="1" class="FormTbl">
<tr class="TitleBarA">
<td width="100%" align="top">Browse Download File : <input type="file" name="userfile" /></td>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0" border="1" class="FormTbl">
<tr class="TitleBarA">
<td width="100%" ><input type="submit" name="submit" id="submit" value="Publish" class="button-primary" /></td>
</tr>
</table>
</div>
</form>
Ok here is the summarized form of problem:
1. when i upload the small size file less than 1mb the images/files(any) are uploaded
2. But when the file size inscrease >1mb the url is not redirected to the controller speciefied in the forms action rather it shows bad request
3. i have checked most of the possibilities like max uload size ,.htaccess file , file execution time and many more.
thanks in advance