Home » Php » javascript – need help on how to upload accordingly using php and dropzonejs

javascript – need help on how to upload accordingly using php and dropzonejs

Posted by: admin February 25, 2020 Leave a comment

Questions:

this is what I have so far function_upload since I’m uploading multiple files so each file gets looped to the correct format/type of documentand I know I have to add my dropzone.options after this but its not working need help figuring it out:

function action_upload($id){



               if(!empty($_FILES)) {
    //                $_FILES['filename']['tmp_name']
                    foreach($_FILES['filename']['tmp_name'] as $key => $value) {
                        $tempFile = $_FILES['filename']['tmp_name'][$key];
                        $targetFile =  $doc_info. $_FILES['filename']['name'][$key];
                        move_uploaded_file($tempFile,$targetFile);
                    }
                }

    //            $_FILES['filename']['tmp_name']
    //                foreach($_FILES['filename']['tmp_name'] as $key => $value) {
    //                    $tempFile = $_FILES['filename']['tmp_name'][$key];
    //                    $targetFile =  $doc_info. $_FILES['filename']['name'][$key];
    //                    move_uploaded_file($tempFile,$targetFile);
    //                }

                $data = parent::action_layout($id);
                if($_POST){

                    try{
                        // Upload to Amazon S3
                        $doc_info = $_POST;
                        $_FILES['document']['document_type'] = $_POST['document_type'];
                        $_FILES['document']['user_filename'] = $_POST['filename'];
                        $path = $_FILES['document']['name'];
                        $ext = pathinfo($path, PATHINFO_EXTENSION);
                        $ext_allowed = array(
                            'jpg','jpeg','png','bmp','pdf'`enter code here`,'txt','doc','docx','xls','xslx','mp3','odt','log','msg','pub','rtf','wav','xps','gif','dotx','csv'
                        );
How to&Answers: