steviemac Posted February 6, 2008 Share Posted February 6, 2008 I want to be able to update a table in a database that also sends a file to a folder on the server. It will send the file to the server but will not update the table. This is my code <?php include "dbmembers.php"; if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/jpg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 40000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } if (file_exists("members_images/" . $_FILES["file"]["name"])) { echo "<B>This name "; echo $_FILES["file"]["name"] . " that you have named your file already exists on the server. Please rename it and upload it again.</B>"; } else { (mysql_query("UPDATE allmembers set photo = '".mysql_real_escape_string($_POST['file']['name'])."' where id = '".mysql_real_escape_string($_POST['id'])."'") or die(mysql_error())) ; move_uploaded_file($_FILES["file"]["tmp_name"], "members_images/" . $_FILES["file"]["name"]); echo "Your file " . $_FILES["file"]["name"] . " has been successfully uploaded to the server."; } } else { echo "Invalid file format. You file is not a .gif or .jpg extension or is to large in size."; } ?> Thank you for your help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.