Welcome Guest, Not a member yet? Register   Sign In
File Uploaded Problem
#1

[eluser]RobbieL[/eluser]
I've been using this multi-file uploading script for the past a few months on a local setup using MAMP on OS X with no problem. I had to switch it over to a Windows XP box using WAMP this morning, and the script has suddenly started causing issues.

The form allows you to upload upto 5 MP3's, and when in OS X it did this just fine. However, on the Windows box it successully works if you only upload 1 MP3, but if you try and upload more than one the $_FILES array comes back as empty and nothing uploads.

I've completely baffeled as to why this is happening, and couldn't of come at worst timing as we're meant to be using this for a presentation tomorrow.

Any help would be much appreciated. Cheers.

Code:
function uploadSong() // Uploads the entered song(s) into the database
{
     $i = 1;
     foreach($_FILES as $key=>$value)
     {
     if(isset($_FILES['userfile'.$i]) && strlen($_FILES['userfile'.$i]['name'] > 0))
     {    
          $config['upload_path'] = './uploads/';
      $config['allowed_types'] = 'mp3';
      $config['max_size'] = '500000';
        
      $this->upload->initialize($config);

      if ( ! $this->upload->do_upload($key))
      {
           $error = array('error'=>$this->upload->display_errors());
                    
           foreach($error as $bob)
           {
                echo 'Error';
           }
      }
      else
      {
           $currentDate = date('d/m/Y');
           $numUploaded = $i;
        
           $filedetails = array('upload_data' => $this->upload->data());
                    
           $getID3 = new getID3;
           $filename = $_FILES['userfile'.$i]['tmp_name'];
           $ThisFileInfo = $getID3->analyze($filename);

           $fileData = array();
           $fileData['name'] = @$ThisFileInfo['tags']['id3v2']['title'][0];
           $fileData['artist'] = @$ThisFileInfo['tags']['id3v2']['artist'][0];
           $fileData['album'] = @$ThisFileInfo['tags']['id3v2']['album'][0];
                                                                                         $this->Music_model->set_songData($fileData,$currentDate);
        }
     }
     else
     {
       echo 'Empty';
     }
     $i++;
  }
}
#2

[eluser]FrankieShakes[/eluser]
Robbie,

Just a hunch... but could it have anything to do with the forward-slash you're using to indicate the upload path:

Code:
$config['upload_path'] = './uploads/';

It still doesn't explain why uploading a single file works, but it might be something worth looking into. Also, have you tried outputting the value of $_FILES before doing anything in the uploadSong function?
#3

[eluser]RobbieL[/eluser]
Thanks for getting back to me Frankie. Smile

I tried moving and changing the upload directory but the issue was still there. I've been printing out the $_FILES array first thing in that function, and it still comes back empty.
#4

[eluser]FrankieShakes[/eluser]
Robbie,

No problem. Wish that had helped. I did come across this though, while trying to find a solution to your problem:

http://us3.php.net/manual/en/ini.core.ph...t-max-size

Here's the quote you might be interested in:

Quote:If the size of post data is greater than post_max_size, the $_POST and $_FILES superglobals are empty. This can be tracked in various ways, e.g. by passing the $_GET variable to the script processing the data, i.e. <form action="edit.php?processed=1">, and then checking if $_GET['processed'] is set.

That might explain why when you upload a single file it works just fine. It's possible your configuration is set to a value lower than the total uploads you're submitting.

Give that a shot and let me/us know how it goes.




Theme © iAndrew 2016 - Forum software by © MyBB