通过php上传多个文件

时间:2014-04-10 03:21:24

标签: php upload

所以继承我的php上传脚本。我可以在数据库中插入这些文件名,但问题是我无法将这些图像移动到目标目的地。

<?php

    require_once('./ssl/ecommerce/config/connect.php');

    $dir = "/Applications/XAMPP/xamppfiles/htdocs/excelsispharma/assets/images/news_events/";
    $file = $_POST['file'];
    $evtName = $_POST['evtName'];


    $sql = "INSERT INTO excelsis_news_events.event(event_name)".
            " VALUES('$evtName') ";
    $ex = $mysqli->query($sql);
    $last = $mysqli->insert_id;
    echo $last;

    foreach ($file as $key ) {

        $sql = " INSERT INTO excelsis_news_events.images(event_id,filename) ".
                " VALUES('$last','$key') ";
        $run = $mysqli->query($sql);

        move_uploaded_file($file,$dir);

    }




?>

0 个答案:

没有答案