Example #1
0
<?php

/**
 * Created by PhpStorm.
 * User: Akihiro
 * Date: 16/02/19
 * Time: 7:54
 */
$user_id = $_POST['user_id'];
$img = $_FILES["img"]["name"];
if ($_FILES['img']['error'] == UPLOAD_ERR_OK) {
    $upload_file = "./images_upload/" . $_FILES["img"]["name"];
    if (move_uploaded_file($_FILES["img"]['tmp_name'], $upload_file)) {
        chmod($upload_file, 0644);
    }
}
require_once "DBAdapter.class.php";
$c = new DBAdapter();
$c->img_add($user_id, $img);
header("Location: index.php");