R
R
redd_i2016-12-26 20:36:58
PHP
redd_i, 2016-12-26 20:36:58

Where to insert SQL query jQuery.filer?

Hello. Trying to figure out how to upload files to the server jQuery.filer
I don't know much about it. I have UPLOADER.PHP file
Code:

<?php
    include('../../../php/class.uploader.php');

    $uploader = new Uploader();
    $data = $uploader->upload($_FILES['files'], 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' => '../../../uploads/', //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)}
        'replace' => false, //Replace the file if it already exists  {Boolean}
        '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' => null //A callback function name to be called by removing files (must return an array) | ($removed_files) | Callback
    ));

    if($data['isComplete']){
        $files = $data['data'];

        echo json_encode($files['metas'][0]['name']);
    }

    if($data['hasErrors']){
        $errors = $data['errors'];
        echo json_encode($errors);
    }

    exit;
?>

Please tell me where it will be correct to insert an SQL query in it so that all uploaded files are written to the table? I will be very grateful for your help

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arman, 2016-12-26
@redd_i

After if($data['isComplete']){
that, look at what you have in $data['data']
if the array, as you can see from the code, then collect the insert in a loop and execute the query at once

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question