Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace App\Model;
- use PDO;
- class UploadImageModel {
- public function uploadImage(){
- if (isset($_FILES['filename'])) {
- $name = strtolower($_FILES['filename']['name']);
- $temp = $_FILES['filename']['tmp_name'];
- move_uploaded_file($temp, IMAGE_DIR . '/' . $name);
- require CONTROLLER_DIR . '/dbConnecterController.php';
- $statement = $db->prepare('INSERT INTO images (imagename) VALUES (:name)');
- $statement->bindParam(':imagename', $name);
- $statement->execute();
- return true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement