Upload multiple files cannot append the files data and upload into selected folder

做~自己de王妃 提交于 2021-01-29 08:53:13

问题


I have created a form to let the user insert document and photo, my problem is I just can append the document data in the table and upload into the selected folder, but I cannot append the photo data in the table and upload into the selected folder, the result like below the picture, the photo data cannot append in the table:

Actually, I want the result like below the picture:

This is my front-end jsfiddle https://jsfiddle.net/9fztkn60/2/

Below is my backend:

    <?php
if(isset($_POST) && $_SERVER['REQUEST_METHOD'] == "POST")
{
    $vpb_file_name = strip_tags($_FILES['upload_file']['name']); //File Name
    $vpb_file_id = strip_tags($_POST['upload_file_ids']); // File id is gotten from the file name
    $vpb_file_size = $_FILES['upload_file']['size']; // File Size
    $vpb_uploaded_files_location = 'C:/xampp/htdocs/uploads_test/'; //This is the directory where uploaded files are saved on your server
    $vpb_final_location = $vpb_uploaded_files_location . $vpb_file_name; //Directory to save file plus the file to be saved
    //Without Validation and does not save filenames in the database
    if(move_uploaded_file(strip_tags($_FILES['upload_file']['tmp_name']), $vpb_final_location))
    {
        //Display the file id
        echo $vpb_file_id;
    }
    else
    {
        //Display general system error
        echo 'general_system_error';
    }

}
?>

Hope someone can guide me on which part I am getting wrong in the Upload photo part. Thanks.

来源:https://stackoverflow.com/questions/65626849/upload-multiple-files-cannot-append-the-files-data-and-upload-into-selected-fold

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!