I got this code, but i keep getting the error error uploading image,but if i take the If statements away it works.
i have 2 if codes in 1 statement is this the correct way?
Code:<?php include "../../conf/db_connect.php"; $name = $_POST['name']; $type = $_POST['type']; $cat = $_POST['cat']; $limit = $_POST['limit']; $minlocation_len = 3; //location minimum length $target_path = "../../images/locations/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(strlen($name) < $minlocation_len) { ?> <script type="text/javascript"> alert ("Location name must be atleased 3 characters!") </script> <meta http-equiv="REFRESH" content="0;url=../newlocation.php"> <?php if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { $request = "INSERT INTO `room` ( `RoomID` , `RoomName` , `RoomType` , `RoomImage` , `RoomLimit` , `RoomCat`) VALUES ( '' , '$name' , '$type' , '$siteurl/images/locations/$name.png' , '$limit' , '$cat');"; // execute the query $result = mysql_query($request) or die(mysql_error()); ?> <script type="text/javascript"> alert ("Location added!") </script> <meta http-equiv="REFRESH" content="0;url=../locations.php"> <?php } } else{ ?> <script type="text/javascript"> alert ("Uploading location image failed!") </script> <meta http-equiv="REFRESH" content="0;url=../newlocation.php"> <?php } ?>




Bookmarks