source: pro-violet-viettel/www/deploy/20150304/upload/upload.php @ 804

Last change on this file since 804 was 780, checked in by dungnv, 10 years ago
File size: 477 bytes
Line 
1<?php
2
3// A list of permitted file extensions
4$allowed = array('png', 'jpg', 'gif','zip');
5
6if(isset($_FILES['upl']) && $_FILES['upl']['error'] == 0){
7
8        $extension = pathinfo($_FILES['upl']['name'], PATHINFO_EXTENSION);
9
10        if(!in_array(strtolower($extension), $allowed)){
11                echo '{"status":"error"}';
12                exit;
13        }
14
15        if(move_uploaded_file($_FILES['upl']['tmp_name'], 'uploads/'.$_FILES['upl']['name'])){
16                echo '{"status":"success"}';
17                exit;
18        }
19}
20
21echo '{"status":"error"}';
22exit;
Note: See TracBrowser for help on using the repository browser.