Welcome Guest, Not a member yet? Register   Sign In
Multiple file upload library
#37

[eluser]Romyblack[/eluser]
[quote author="Pent" date="1345583684"]Just registered to say this was exactly what I was looking for, thank you very much. I do however run in a minor issue, if there are multiple entries in the "error" array (the files that did not get uploaded) their error messages are concatenated, like this (I'm echoing the file names and the error messages):

(filename1)

The file you are attempting to upload is larger than the permitted size.

(filename2)

The file you are attempting to upload is larger than the permitted size.

The file you are attempting to upload is larger than the permitted size.

So the first error message under filename2 is actually the error message of filename1. I found out this happens because for uploading all the files, one instance of the upload class is used, and the error messages are just added together (because one file can have multiple error messages). It can be fixed by clearing the error array after merging it in the $uploaded_info, like this:
Code:
#Here we do the upload process
   foreach($_FILES as $file => $value){
    if( $value['size'] > 0 ){
     if (!$this->do_upload($file)){
      $uploaded_info['error'][]  =  array_merge($this->data(),
          array('error_msg' => $this->display_errors()));
      $this->error_msg = array();
      
     }
     else{
      $uploaded_info['success'][] =  array_merge($this->data(),
          array('error_msg' => $this->display_errors()));
      $this->error_msg = array();
     }
    }
   }
[/quote]

Quote:Hi the problem was resolved please see the post and download the new version. thanks buddy.
Multiple file upload library


Messages In This Thread
Multiple file upload library - by El Forum - 01-06-2012, 05:36 AM
Multiple file upload library - by El Forum - 01-19-2012, 03:56 PM
Multiple file upload library - by El Forum - 01-20-2012, 11:26 AM
Multiple file upload library - by El Forum - 01-20-2012, 03:57 PM
Multiple file upload library - by El Forum - 01-21-2012, 04:18 PM
Multiple file upload library - by El Forum - 01-27-2012, 07:45 PM
Multiple file upload library - by El Forum - 02-06-2012, 08:42 AM
Multiple file upload library - by El Forum - 02-06-2012, 08:59 AM
Multiple file upload library - by El Forum - 02-06-2012, 02:22 PM
Multiple file upload library - by El Forum - 02-07-2012, 06:20 AM
Multiple file upload library - by El Forum - 03-28-2012, 10:31 AM
Multiple file upload library - by El Forum - 03-28-2012, 08:35 PM
Multiple file upload library - by El Forum - 03-29-2012, 04:01 AM
Multiple file upload library - by El Forum - 05-18-2012, 12:15 PM
Multiple file upload library - by El Forum - 05-23-2012, 08:32 AM
Multiple file upload library - by El Forum - 06-03-2012, 01:14 AM
Multiple file upload library - by El Forum - 06-08-2012, 01:01 PM
Multiple file upload library - by El Forum - 06-08-2012, 09:13 PM
Multiple file upload library - by El Forum - 06-09-2012, 04:05 AM
Multiple file upload library - by El Forum - 06-09-2012, 05:28 PM
Multiple file upload library - by El Forum - 06-14-2012, 03:41 PM
Multiple file upload library - by El Forum - 06-14-2012, 07:23 PM
Multiple file upload library - by El Forum - 06-16-2012, 02:51 AM
Multiple file upload library - by El Forum - 08-06-2012, 05:14 AM
Multiple file upload library - by El Forum - 08-06-2012, 05:23 AM
Multiple file upload library - by El Forum - 08-06-2012, 06:30 AM
Multiple file upload library - by El Forum - 08-08-2012, 06:41 AM
Multiple file upload library - by El Forum - 08-08-2012, 06:45 AM
Multiple file upload library - by El Forum - 08-18-2012, 06:45 AM
Multiple file upload library - by El Forum - 08-21-2012, 02:14 PM
Multiple file upload library - by El Forum - 08-21-2012, 11:25 PM
Multiple file upload library - by El Forum - 08-22-2012, 02:45 AM
Multiple file upload library - by El Forum - 10-04-2012, 11:25 PM
Multiple file upload library - by El Forum - 10-13-2012, 10:48 PM
Multiple file upload library - by El Forum - 10-20-2012, 08:33 PM
Multiple file upload library - by El Forum - 10-20-2012, 08:35 PM
Multiple file upload library - by El Forum - 10-20-2012, 09:32 PM
Multiple file upload library - by El Forum - 10-20-2012, 09:34 PM
Multiple file upload library - by El Forum - 10-21-2012, 08:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB