<?php
if($_POST){
if($_FILES['file']['size'] > 0 && $_FILES['file']['error'] ==0 && $_FILES['file']['type'] == 'image/jpeg'){
//upload file
//$_FILES['file']['type'] == 'image/jpeg' untuk validasi hanya jpg file
}
}
?>
<form method="post" action="" enctype="multipart/form-data">
<input type="file" name="file"/>
<input type="submit" name="submit" value="submit"/>
</form>