legohead6 Posted May 28, 2006 Share Posted May 28, 2006 Hi. I have a site where members can buy and sell good! and on the addlisting page they upload a picture to showcase there item then on listing.php i want to show the pic but for sum reason the pics dont show up! but when i go to frontpage and use the insert picture command and get one off my c drive they do and the code is exacaly the same! is there something wrong with my uploader? is it missing something?heres the uploading page[code]<?PHPsession_start();$errors = array();$user=$_SESSION['user'];echo "<a href=home.php>Return Home</a>";if(empty($_POST['ti'])){ $errors[] = '<p><font color=\"yellow\">*Please enter a Title!</font></p>'; }else{ $ti=$_POST['ti']; } if(empty($_POST['pr'])){ $errors[] = '<p><font color=\"yellow\">*Please enter a Price!</font></p>'; }else{ $pr=$_POST['pr']; } if(empty($_POST['de'])){ $errors[] = '<p><font color=\"yellow\">*Please enter a Description!</font></p>'; }else{ $de=$_POST['de']; } if(move_uploaded_file($_FILES['ph']['tmp_name'], "listingphoto/{$_FILES['ph']['name']}")) { }else{ $errors[] = '<p><font color=\"yellow\">*Sorry There was a Problem Uploading Your Picture, Please Try again!</font></p>'; }if(isset($_POST['submit'])){if (empty($errors)) {$username="********";$password="*******";$database="mattswebpage_com_-_web";mysql_connect(localhost,$username,$password);@mysql_select_db($database) or die( "Unable to select database"); echo "<br><br>Your Listing Was successfully Posted!";$query2="INSERT INTO listings VALUES('','$ti','$pr','$de','{$_FILES['ph']['name']}','$user')";$result2 = mysql_query($query2) or die ("Error in query: $query2. ".mysql_error()); }else{foreach ($errors as $key){echo "$key";}} } echo "<form enctype=multipart/form-data method=post> <p>Title:<input type=text name=ti size=20></p> <p>Price:<input type=text name=pr size=12></p> <p>Photo:<input type=file name=ph size=20></p> <p>Description:<br> <textarea rows=5 name=de cols=23></textarea></p> <p><input type=submit value=Submit name=submit></p></form>";?>[/code]and on the viewing page theres just a echo "<img border=0 src=photo/$row[4]>the row displayspic.jpg Quote Link to comment https://forums.phpfreaks.com/topic/10649-getting-and-displaying-a-picture-from-http/ Share on other sites More sharing options...
AndyB Posted May 28, 2006 Share Posted May 28, 2006 photo/ isn't where you're moving the images, it's listingphoto/ Quote Link to comment https://forums.phpfreaks.com/topic/10649-getting-and-displaying-a-picture-from-http/#findComment-39741 Share on other sites More sharing options...
legohead6 Posted May 28, 2006 Author Share Posted May 28, 2006 [!--quoteo(post=377865:date=May 28 2006, 11:10 AM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ May 28 2006, 11:10 AM) [snapback]377865[/snapback][/div][div class=\'quotemain\'][!--quotec--]photo/ isn't where you're moving the images, it's listingphoto/[/quote]ya i know...i was trying putting the pics in the root folder and i forgot to change back..it has to be something with how the pic was uploaded...because when i take a pic off my c drive on a page with frontpage it works fine Quote Link to comment https://forums.phpfreaks.com/topic/10649-getting-and-displaying-a-picture-from-http/#findComment-39745 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.