PHP Indonesia - Facebook | PHP Indonesia is a community for everyone that loves PHP. Our focus is in the PHP world but our topics encompass the entire LAMP stack. Topics include PHP coding, to memcached handling, db optimizations, server stack, web server tuning, code deploying, hosting options and much much more. Youtube Channel : http://www.youtube.com/user/OurPHPIndonesia Twitter : @php_indonesia NOTE: Rules for Wall posting: https://www.facebook.com/groups/35688476100/doc/10151597056316101/ Daftar Keanggotaan : http://www.facebook.com/groups/35688476100/doc/10150671770741101/ | |
|
Why I Can't restrict the jpg files?? what could be... Sep 2nd 2013, 14:32, by Arup Debnath | Why I Can't restrict the jpg files?? what could be changed??
<?php $temp = $_FILES["file"]["tmp_name"]; $name = $_FILES["file"]["name"]; $type = $_FILES["file"]["type"];
if($type == "image/jpg") die ("Can't Be Uploaded As jpg Format!");
else if ($_FILES["file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . "<br>"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br>"; echo "Type: " . $_FILES["file"]["type"] . "<br>"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>"; echo "Stored in: " . $_FILES["file"]["tmp_name"]; move_uploaded_file ($temp,"upload/".$name); } ?> |
| | try to die($type) before conditional check to look actual value | | |
|
Tidak ada komentar:
Posting Komentar