Jump to content

Archived

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

legohead6

getting and displaying a picture from http

Recommended Posts

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]<?PHP
session_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 displays

pic.jpg

Share this post


Link to post
Share on other sites
photo/ isn't where you're moving the images, it's listingphoto/

Share this post


Link to post
Share on other sites
[!--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

Share this post


Link to post
Share on other sites

×

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.