this is the code and thanks by the way!
<?php
function uploadform($enable){
if($enable == true){
print('<form enctype="multipart/form-data" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
Choose a file to upload: <br /><input name="upfile" type="file" />
<input type="submit" name="upload" value="Upload" style="height: 20px; font-size: 12px;"/>
</form>');
}else{
print('the service has been disable. Should be back shortly!');
}
}
if(!isset($_POST['upload'])){
print uploadform(1);
}else{
$filenm = basename($_FILES['upfile']['name']);
$ext = basename($_FILES['upfile']['type']);
$rand = rand(0000,9999);
$randname = $rand.$filenm;
$target = "files/".$randname;
$qry = move_uploaded_file($_FILES['upfile']['tmp_name'],$target);
if(!isset($qry)){
echo('error');
}else{
echo($randname);
}
}
?>
