Nasıl kalıp move_uploaded_file sonucunda aynı yerde ($ izin) if () mesajı görüntülerim?
<?php
$destination_path = $_SERVER['DOCUMENT_ROOT'].'/uploads/';
$allowed[] = 'image/gif';
$allowed[] = 'image/jpeg';
$allowed[] = 'image/pjpeg';
$allowed[] = 'image/png';
if (!in_array($_FILES['myfile']['type'], $allowed)) {
die('Wrong file type!');
}
$result = 0;
$now = time();
$ext = end(explode(".", $_FILES['myfile']["name"]));
$filename = ( $_FILES['myfile'][0].$now.".".$ext);
if(@move_uploaded_file($_FILES['myfile']['tmp_name'], $destination_path .$filename)) {
$result = 1;
}
sleep(1);
?>
<script language="javascript" type="text/javascript"> window.top.window.stopUpload('<? php echo $result; ?>', '<?php echo $filename; ?>');</script>
Move_uploaded_file sonucunu görüntülemek için Javascript:
function stopUpload(success,filename){
var result = '';
if (success == 1){
result = '<span class="msg">Great!<\/span><br/><br/>';
}
else {
result = '<span class="emsg">Not so great.<\/span><br/><br/>';
}