Welcome Guest, Not a member yet? Register   Sign In
Uploading Files
#1

[eluser]PixelPanic[/eluser]
Hi

I am having a strange issue when using the CI Uploading Class (2.1.0)
Basically trying to upload only MP3 files, however i'm getting a strange issue. Sometimes files upload and sometimes they don't (However the ones that upload fine will always upload, and the ones that fail will always fail. Even in Chrome, IE, FF. Different MP3 Files. I don't believe it to be a filename issue.


I get this error randomly on some MP3 files
You did not select a file to upload.


Server Setup
Set to allow 20mb uploads, timeout for PHP is 120 and input timeout is 120, so I don't believe it to be a PHP timeout issue.
PHP 5.3.10 no hardening as it's a dedi VPS hosting just the Radio Station.

Had some issues with MIME types with different browsers so I made some MIME changes
Code:
'mp3'    =>    array('audio/mpeg','audio/mpeg3','audio/mpg','audio/x-mpeg','audio/mp3','application/force-download','application/octet-stream'),

In my controller
Code:
public function song_upload()
{
        $config = array(
             'allowed_types' => 'mp3|mp4|wmv|mpeg',
             'upload_path' => './uploads/artists/songs/'
        );
        
        $this->load->library('upload', $config);
  
  if ( ! $this->upload->do_upload('userfile'))
  {
   echo $this->upload->display_errors();
  }
  
  else
  {
  
   $data = $this->upload->data();
  
   $filename = $data['file_name'];
  
   $filestable= array(
    'filename' => str_replace(' ','_',$filename),
    'username' => $this->input->post('id'),
    'songname' => $this->input->post('songname')
   );
  
   $this->db->insert('artist_songs', $filestable);
    
   redirect('/admin/artists');
  }
}

The form bit in the view file that calls the form
Code:
<?=form_open_multipart('admin/artists/song_upload/' . $this->uri->segment(4));?>
      <input type="hidden" name="id" value="<?php echo $this->uri->segment(4); ?>">
      <h2>Upload A Song</h2>
      <div>
        <p class="left">
          <label>Upload Song:</label>
          &lt;input name="userfile" type="file" id="userfile" size="10" class="inputText" /&gt;
        </p>
      </div>
      <p class="right">
        <label>Song Title:</label>
        &lt;input name="songname" type="text" class="inputText" id="textfield" value="&lt;?php echo set_value('songname'); ?&gt;" /&gt;
      </p>
      <div class="clear"></div>
      <button type="submit" class="button">Submit</button>
      &lt;?php echo form_close(); ?&gt;
#2

[eluser]Pschilly[/eluser]
I've been attempting to help him with this, and we have tried several other fixes already posted elsewhere... Including the php.ini fix for CGI routing, the .htaccess fix adding the ? in the mix... None seem to work.
#3

[eluser]PixelPanic[/eluser]
Turns out to be a post_max_size issue even though all the others where set correctly looks like one was missed




Theme © iAndrew 2016 - Forum software by © MyBB