Jump to content

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
[!--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
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.