26 lines
519 B
PHP
26 lines
519 B
PHP
|
<?php
|
||
|
if(isset($_FILES['file'])){
|
||
|
$file = $_FILES['file'];
|
||
|
|
||
|
//File Properties
|
||
|
$file_name = $file['name'];
|
||
|
$file_tmp = $file['tmp_name'];
|
||
|
$file_size = $file['size'];
|
||
|
$file_error = $file['error'];
|
||
|
|
||
|
|
||
|
//Work out file extension
|
||
|
$file_ext = explode('.',$file_name);
|
||
|
$file_ext = strtolower(end($file_ext));
|
||
|
|
||
|
|
||
|
|
||
|
if($file_error == 0){
|
||
|
$file_new = '(' . uniqid('',true) . ')' . $file_name;
|
||
|
$file_dest = 'uploads/' . $file_new;
|
||
|
if(move_uploaded_file($file_tmp,$file_dest)){
|
||
|
echo 'SUCCESS';
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|