Welcome Guest, Not a member yet? Register   Sign In
Urgent Help
#1

[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>


&lt;?php
  if(isset($msg)){
?&gt;
<table width="100%" cellpadding="0" cellspacing="0" border="1" class="FormTbl">
   <tr class="TitleBarA">
    
    <td width="100%">&lt;?php echo $msg;?&gt;</td>
   </tr>
</table>
&lt;?php
}
?&gt;    
<table width="100%" cellpadding="0" cellspacing="0" border="1" class="FormTbl">
   <tr class="TitleBarA">
    
    <td width="100%">File Name : &lt;input type="text" name="filename" id="filename"  class="inputBox" value="" /&gt;&lt;?php echo form_error('filename', '<span class="error">', '</span>'); ?&gt;</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>
          &lt;?php
           $allcat = count($downloadcategory);
           for($i=0 ; $i<$allcat; $i++){
            @$midcount = count($downloadcategory);
          
                                    ?&gt;
                                 <option  value="&lt;?php echo $downloadcategory[$i]['dcid'];?&gt;" > &lt;?php echo $downloadcategory[$i]['cat_name'];?&gt;</option>
                                    
                                    &lt;?php
           }
            ?&gt;
                                </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  : &lt;input type="file" name="userfile" /&gt;&lt;/td>
    
   </tr>
     </table>
      
     <table width="100%" cellpadding="0" cellspacing="0" border="1" class="FormTbl">
   <tr class="TitleBarA">
    
    <td width="100%" >&lt;input type="submit" name="submit" id="submit"  value="Publish" class="button-primary" /&gt;&lt;/td>
   </tr>
     </table>    
</div>
&lt;/form&gt;

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
#2

[eluser]zoreli[/eluser]
Hi

This solution works for me:

Code:
ini_set('max_upload_filesize', 983886080);

Regards, Zoreli




Theme © iAndrew 2016 - Forum software by © MyBB