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++;
  }
}


Messages In This Thread
File Uploaded Problem - by El Forum - 05-08-2008, 07:14 AM
File Uploaded Problem - by El Forum - 05-08-2008, 08:14 AM
File Uploaded Problem - by El Forum - 05-08-2008, 08:40 AM
File Uploaded Problem - by El Forum - 05-08-2008, 07:52 PM



Theme © iAndrew 2016 - Forum software by © MyBB