Jump to content

File Uploads


lalnfl

Recommended Posts

This doesn't seem to be working. Any help?

 

if (isset ($_POST['edit_poser'])){

$errormsg = "";

if (!$_FILES['userfile']['tmp_name']){

$errormsg = "<font style='color: #ff0000;'>Select an Image</font>";

}

else {

$maxfilesize = 51200;

if ($_FILES['userfile']['size'] > $maxfilesize){

$errormsg = "<font style='color: #ff0000;'>Image is too large, select a smaller one</font>";
unlink($_FILES['userfile']['tmp_name']);

}

else if (!preg_match("/\.(gif|jpg|png)$/i" , $_FILES['userfile']['name'])){

$errormsg = "<font style='color: #ff0000;'>Image needs to be gif, jpg, or png</font>";
unlink($_FILES['userfile']['tmp_name']);

}

else {

$newname = "image01.jpg";
$place_file = move_uploaded_file($_FILES['userfile']['tmp_name'], "Members/$id/".$newname);
$errormsg = "<font style='color: #ff0000;'>Your image has successfully been updated</font>";


}

}

} // ends first if statement

Link to comment
https://forums.phpfreaks.com/topic/215310-file-uploads/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.