KLanding/upload.php

22 lines
473 B
PHP
Raw Normal View History

2015-07-10 09:47:15 +01:00
<?php
2015-07-26 08:33:54 +01:00
// A list of permitted file extensions
$allowed = array('png', 'jpg', 'gif','zip');
if(isset($_FILES['upl']) && $_FILES['upl']['error'] == 0){
$extension = pathinfo($_FILES['upl']['name'], PATHINFO_EXTENSION);
if(!in_array(strtolower($extension), $allowed)){
echo '{"status":"error"}';
exit;
}
if(move_uploaded_file($_FILES['upl']['tmp_name'], 'Pic/'.$_FILES['upl']['name'])){
echo '{"status":"success"}';
exit;
}
2015-07-10 09:47:15 +01:00
}
2015-07-26 08:33:54 +01:00
echo '{"status":"error"}';
exit;