Ifrit's avatar

How to have more then one $_FILES[]

I know that this isn't really a laravel question even though once I've got this working I will be trying to save the images using laravel, but you guys are alot faster at responding and helping then php forum.

I'm busy doing a drag and drop uploader tutorial and I've managed to get it to work with only 1 image, but now I'm trying to do it with 2 separate input files.

My image.html

   <input type="file" name="images[]" id="filer_input2" multiple="multiple">
     <input type="file" name="images2[]" id="filer_input3" multiple="multiple">

my upload.php

     $data = $uploader->upload($_FILES['images'], array(
        'limit' => 10, //Maximum Limit of files. {null, Number}
        'maxSize' => 10, //Maximum Size of files {null, Number(in MB's)}
        'extensions' => null, //Whitelist for file extension. {null, Array(ex: array('jpg', 'png'))}
        'required' => false, //Minimum one file is required for upload {Boolean}
        'uploadDir' => '../'.$test_dir.'/', //Upload directory {String}
        'title' => array('name'), //New file name {null, String, Array} *please read documentation in README.md
        'removeFiles' => true, //Enable file exclusion {Boolean(extra for jQuery.filer), String($_POST field name containing json data with file names)}
        'perms' => null, //Uploaded file permisions {null, Number}
        'onCheck' => null, //A callback function name to be called by checking a file for errors (must return an array) | ($file) | Callback
        'onError' => null, //A callback function name to be called if an error occured (must return an array) | ($errors, $file) | Callback
        'onSuccess' => null, //A callback function name to be called if all files were successfully uploaded | ($files, $metas) | Callback
        'onUpload' => null, //A callback function name to be called if all files were successfully uploaded (must return an array) | ($file) | Callback
        'onComplete' => null, //A callback function name to be called when upload is complete | ($file) | Callback
        'onRemove' => 'onFilesRemoveCallback' //A callback function name to be called by removing files (must return an array) | ($removed_files) | Callback
    ));

My question is how do I get this to work so that I can have 2 or more input files that have different names.

0 likes
0 replies

Please or to participate in this conversation.