Web Hosting Talk







View Full Version : how protection upload from members {jpg-gif-png} only ?


3okl
09-18-2008, 07:06 PM
if member have none photo the uploader start upload anyfile {danger}

if member have photo the uploader remove first photo and upload the file {Danger}
- - - - - - - - - - - - - - - - - -

how protection my upload from members to disable all files except

{JPG - PNG - GIF}

My code
move_uploaded_file($_FILES["photo"]["tmp_name"],"../users");

Doh004
09-19-2008, 01:14 AM
if (($_FILES['photo']['type'] == 'image/gif') || ($_FILES['photo']['type'] == 'image/jpeg') || ($_FILES['photo']['type'] == 'image/pjpeg') || ($_FILES['photo']['type'] == 'image/png')){
// Upload the file and such
}
else{
echo 'You can only upload certain image types';
}

3okl
09-19-2008, 10:54 AM
Thanks it's working fine :)