Welcome Guest, Not a member yet? Register   Sign In
Multiple file uploads
#11

[eluser]amites[/eluser]
the advantage of my release is the integration of the JQuery multi-upload plugin

thus 1 upload button = (name your limit) # of files

suppose plugging it into the WIKI might be a good idea

Happy Holidays
#12

[eluser]Mitja B.[/eluser]
does CI 1.7 has any new solution for this or is this still the best solution?
#13

[eluser]amites[/eluser]
this is the best solution that I'm aware of, short of building your own which isn't particularly difficult,

if you are looking for something more customized then feel free to play with it and make it your own
#14

[eluser]Bob Sawyer[/eluser]
[quote author="amites" date="1230197533"]Another option is to use the library I published at

http://www.mitesdesign.com/blog/open-sou...de-igniter

uses a JQuery dialog to upload multiple files from a single input, though the process beyond that is much the same as what's been posted, though I don't know if they've tested their code [/quote]

I was already using the jquery multifile upload plugin but ran into the issue everyone else is having here. Was glad to find your CI library, but I'm having some trouble with it. Mainly, it's not uploading the files, and not reporting any errors back to me.

INPUT:
Code:
<input type="file" name="userfile[]" id="claimfile" class="multi" maxlength="5" accept="pdf|doc|docx|xls|gif|jpg|zip"/>

CONTROLLER:
Code:
$config['upload_path'] = '/files/';
$config['allowed_types'] = 'pdf|doc|docx|xls|gif|jpg|zip';
$config['max_size']    = '0';
$config['encrypt_name'] = TRUE;
$this->load->library('upload', $config);
$this->load->library('Multi_upload');

Now, I should note that I'm passing along other form data that I'm running through CI's standard validation routines. If there are no other form validation errors, then I check on my files. This is almost a verbatum copy/paste from your sample code:
Code:
$files = $this->multi_upload->go_upload();
                
if ( ! $files ) {
    $x['error'] = array('error' => $this->upload->display_errors());
    $this->load->view('/admin/jobs_add_v', $x);
} else {
    $x['data'] = array('upload_data' => $files);
    $job_id = $this->Sql->insertJob($_POST); # from form data
    $this->load->view('/admin/jobs_add_v',$x);
}

$error is echo'd out on the view page, and contains nothing; neither does $data. And the files are not uploaded. My logs also don't indicate any errors.

Any ideas?

thanks,
Bob
#15

[eluser]Bob Sawyer[/eluser]
Disregard... I had made some modifications to the jquery.MultiFile.js file that were causing problems.
#16

[eluser]CrustyDOD[/eluser]
[quote author="Bob Sawyer" date="1234582903"]Disregard... I had made some modifications to the jquery.MultiFile.js file that were causing problems.[/quote]
Can you post/tell the modifications you did?
I'm having the same problem and can't figure it out :S
#17

[eluser]Bob Sawyer[/eluser]
[quote author="CrustyDOD" date="1234659435"][quote author="Bob Sawyer" date="1234582903"]Disregard... I had made some modifications to the jquery.MultiFile.js file that were causing problems.[/quote]
Can you post/tell the modifications you did?
I'm having the same problem and can't figure it out :S[/quote]

I was having problems getting the whole 'STRING: { remove: }' stuff to work, so I hardcoded the icon image I wanted to use to replace the '[remove'] that is usually placed next to the file.
#18

[eluser]CrustyDOD[/eluser]
Ok, it doesn't work cause the function returns FALSE since there's an error 4 aka no file uploaded. And this comes from the fact that JQuery Multiple Upload always submits 1 empty field.

Here it return FALSE since case 4 exists..
Code:
if ( ! is_uploaded_file($_FILES[$field]['tmp_name'][$i]))

            {

                $error = ( ! isset($_FILES[$field]['error'][$i])) ? 4 : $_FILES[$field]['error'][$i];



                switch($error)

                {

                    case 1:  // UPLOAD_ERR_INI_SIZE

                        $error_hold[$i] = 'upload_file_exceeds_limit';

                    break;

                    case 2: // UPLOAD_ERR_FORM_SIZE

                        $error_hold[$i] = 'upload_file_exceeds_form_limit';

                    break;

                    case 3: // UPLOAD_ERR_PARTIAL

                       $error_hold[$i] = 'upload_file_partial';

                    break;

                    case 4: // UPLOAD_ERR_NO_FILE

                       $error_hold[$i] = 'upload_no_file_selected';

                    break;

                    case 6: // UPLOAD_ERR_NO_TMP_DIR

                        $error_hold[$i] = 'upload_no_temp_directory';

                    break;

                    case 7: // UPLOAD_ERR_CANT_WRITE

                        $error_hold[$i] = 'upload_unable_to_write_file';

                    break;

                    case 8: // UPLOAD_ERR_EXTENSION

                        $error_hold[$i] = 'upload_stopped_by_extension';

                    break;

                    default :

                        $error_hold[$i] = 'upload_no_file_selected';

                    break;

                }



                return FALSE;

            }

??
#19

[eluser]amites[/eluser]
try copying the original JQuery file over and check that,

if that's a nogo try
Code:
print_r($_FILES);
#20

[eluser]CrustyDOD[/eluser]
I've fixed it by looping over $_FILES and removing empty fields before that lines.

I'm using the latest jquery..

Just curious how come that this is working for some people when its obvious that the error will stop the function since empty field is always submitted with form.. Or does it only work with some old version of jquery.. Weird..




Theme © iAndrew 2016 - Forum software by © MyBB