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

[eluser]Romyblack[/eluser]
[quote author="karlis_i" date="1333018873"]Modified this great library to enable optional file uploads ( no more "You did not select a file to upload." messages )-
What you need to do is wrap upload process in "if" block at line 115:

replace
Code:
#Here we do the upload process
foreach ($uploaded_files as $file => $value) {
    if (!$this->do_upload($file)) {
        $uploaded_info['error'][] = array_merge($this->data(), array('error_msg' => $this->display_errors()));
    } else {
        $uploaded_info['success'][] = array_merge($this->data(), array('error_msg' => $this->display_errors()));
    }
}

with
Code:
#Here we do the upload process
foreach ($uploaded_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()));
        } else {
            $uploaded_info['success'][] = array_merge($this->data(), array('error_msg' => $this->display_errors()));
        }
    }
}
[/quote]

Thanks for your contribution karlis_i


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