Welcome Guest, Not a member yet? Register   Sign In
Ajax to display multiple error messages.
#2

You don't need this part at all:

PHP Code:
if (!$json) { 

since $json will always be not true.

Also, you want to save error for every not uploaded file so correct nesting would be:

PHP Code:
if ( ! $this->upload->do_upload($fieldname))
{
 
   $json['error'][$i] = $this->upload->display_errors();//note that $json['error'] becomes array
 
   $check_if_any_error++;


After that what is left is to save success message if all files are uploaded with no errors:

PHP Code:
if ((int)$check_if_any_error 1)//or alternatively if (count($json['error']) < 1)
{
 
   $json['success'] = 'You have upload your selected files!';


Then, handle response well as you get (if any) array for errors.
Reply


Messages In This Thread
RE: Ajax to display multiple error messages. - by Tpojka - 04-02-2016, 02:41 PM



Theme © iAndrew 2016 - Forum software by © MyBB