Jump to content

Recommended Posts

These r my files:

 

Upload.php


<?php
$db = mysql_connect("localhost","root","") or
die ("Unable to connect. Check your connection parameters.");
mysql_select_db("moviesite", $db) or die(mysql_error($db));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>upload_image</title>
</head>

<body>
<form action="check_image.php" method="post" enctype="multipart/form-data">
<table>
<tr>
<td> Your Username </td>
<td> <input type="text" name="username"/> </td>
</tr>
<td> Upload Image* </td>
<td> <input type="file" name="image_filename"/> </td>
</tr> <tr>
<td colspan="2">
<small> <em> * Acceptable image formats include: GIF, JPG/JPEG and PNG.
</em> </small>
</td>
</tr> <tr>
<td> Image Caption <br/>
</td>
<td> <input type="text" name="caption" /> </td>
</tr > <tr>
<td colspan="2" style="text-align: center">
<input type="submit" name="submit" value="Upload"/>
</td>
</tr>
</table>
</form>
</body>
</html>

 

check_image.php

 


<?php
$db = mysql_connect("localhost","root","") or
die ("Unable to connect. Check your connection parameters.");
mysql_select_db("moviesite", $db) or die(mysql_error($db));

//change this path to match your images directory
$dir ="C:/xampp/htdocs/WroxPhp6.0/img";
//make sure the uploaded file transfer was successful

if ($_FILES["uploadfile"]["error"] != UPLOAD_ERR_OK) {
switch ($_FILES["uploadfile"]["error"]) {
case UPLOAD_ERR_INI_SIZE:
die("The uploaded file exceeds the upload_max_filesize directive " .
"in php.ini.");
break;
case UPLOAD_ERR_FORM_SIZE:
die("The uploaded file exceeds the MAX_FILE_SIZE directive that " .
"was specified in the HTML form.");
break;
case UPLOAD_ERR_PARTIAL:
die("The uploaded file was only partially uploaded.");
break;
case UPLOAD_ERR_NO_FILE:
die("No file was uploaded.");
break;
case UPLOAD_ERR_NO_TMP_DIR:
die("The server is missing a temporary folder.");
break;
case UPLOAD_ERR_CANT_WRITE:
die("The server failed to write the uploaded file to disk.");
break;
case UPLOAD_ERR_EXTENSION:
die("File upload stopped by extension.");
break;
}
}
//get info about the image being uploaded
$uploadfile = $_POST["uploadfile"];
$image_caption = $_POST["caption"];
$image_username = $_POST["username"];
$image_date = date("Y-m-d");
list($width, $height, $type, $attr) = getimagesize($_FILES["uploadfile"]["tmp_name"]);
// make sure the uploaded file is really a supported image
switch ($type) {
case IMAGETYPE_GIF:
$image = imagecreatefromgif($_FILES["uploadfile"]["tmp_name"]) or
die("The file you uploaded was not a supported filetype.");
$ext = ".gif";
break;
case IMAGETYPE_JPEG:
$image = imagecreatefromjpeg($_FILES["uploadfile"]["tmp_name"]) or
die("The file you uploaded was not a supported filetype.");
$ext = ".jpg";
break;
case IMAGETYPE_PNG:
$image = imagecreatefrompng($_FILES["uploadfile"]["tmp_name"]) or
die("The file you uploaded was not a supported filetype.");
$ext = ".png";
break;
default:
die("The file you uploaded was not a supported filetype.");
}
//insert information into image table
$query = "INSERT INTO images (image_caption, image_username, image_date)
VALUES ('$image_caption.', '$image_username', '$image_date')";
$result = mysql_query($query, $db) or die (mysql_error($db));
//retrieve the image_id that MySQL generated automatically when we inserted
//the new record
$last_id = mysql_insert_id();
//because the id is unique, we can use it as the image name as well to make
//sure we don’t overwrite another image that already exists
$imagename = $last_id.$ext;
// update the image table now that the final filename is known.
$query = "UPDATE images SET image_filename = '.$imagename.'
WHERE image_id = '' . $last_id;
$result = mysql_query($query, $db) or die (mysql_error($db));
//save the image to its final destination
switch ($type) {
case IMAGETYPE_GIF:
imagegif($image, $dir . '/' . $imagename);
break;
case IMAGETYPE_JPEG:
imagejpeg($image, $dir . '/' . $imagename, 100);
break;
case IMAGETYPE_PNG:
imagepng($image, $dir . '/' . $imagename);
break;
}
imagedestroy($image);"
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Here's your pic</title>
</head>
<body>
<h1> So how does it feel to be famous? </h1 >
<p> Here is the picture you just uploaded to our servers: </p >
<img src="images/ <?php echo $imagename; ?>" style="float:left;">
<table>
<tr> <td> Image Saved as: </td> <td> <?php echo $imagename; ?> </td> </tr>
<tr> <td> Image Type: </td> <td> <?php echo $ext; ?> </td> </tr>
<tr> <td> Height: </td> <td> <?php echo $height; ?> </td > </tr>
<tr> <td> Width: </td> <td> <?php echo $width; ?> </td > </tr>
<tr> <td> Upload Date: </td > <td > <?php echo $image_date; ?> </td > </tr>
</table>
</body>
</html>

 

This is my table:

 

<?php
$db = mysql_connect("localhost", "root", "") or
die ("Unable to connect. Check your connection parameters.");
mysql_select_db("moviesite", $db) or die(mysql_error($db));
//create the images table
$query = 'CREATE TABLE images (
image_id INTEGER NOT NULL AUTO_INCREMENT,
image_caption VARCHAR(255) NOT NULL,
image_username VARCHAR(255) NOT NULL,
image_filename VARCHAR(255) NOT NULL DEFAULT "",
image_date DATE NOT NULL,
PRIMARY KEY (image_id)
)
ENGINE=MyISAM';
mysql_query($query, $db) or die (mysql_error($db));
echo "Images table successfully created.";
?>

 

Now, the problem I'm encountering is this:

1. When I execute this script, all the table fields are filled but  the image_filename is empty.

2. On the html output, an "x" displays rather than the actual image uploaded.

 

What am I doing wrong now? Please can some1 tell me? Be so grateful.

Link to comment
https://forums.phpfreaks.com/topic/214722-image-upload-in-php-60/
Share on other sites

1. try echoing out the filename JUST BEFORE you attempt to insert into the table - this will tell you if the variable has what you are expecting it to contain.

 

2. the x is the result of (A) no filename being in the table, OR (B) no image found by that name

The UPDATE query in check_image.php is incorrectly written. The closing double-quote is at the end of some php code (making the php code part of the query string.) The closing double-quote on that query should be at the end of the query.

 

And I see how this might have occurred. There should be a double-quote in the query, right before the dot in: . $last_id; There are two single-quotes instead.

 

Change the two single-quotes to a double-quote and remove the double-quote that you added after the imagedestroy($image);"

The UPDATE query in check_image.php is incorrectly written. The closing double-quote is at the end of some php code (making the php code part of the query string.) The closing double-quote on that query should be at the end of the query.

 

And I see how this might have occurred. There should be a double-quote in the query, right before the dot in: . $last_id; There are two single-quotes instead.

 

Change the two single-quotes to a double-quote and remove the double-quote that you added after the imagedestroy($image);"

 

You seem to be close to the answer pf, I adjusted the code thus and there was a slight improvement:

 

check_image.php

<?php
$db = mysql_connect("localhost","root","") or
die ("Unable to connect. Check your connection parameters.");
mysql_select_db("moviesite", $db) or die(mysql_error($db));

//change this path to match your images directory
$dir ="C:/xampp/htdocs/WroxPhp6.0/img";
//make sure the uploaded file transfer was successful

if ($_FILES["uploadfile"]["error"] != UPLOAD_ERR_OK) {
switch ($_FILES["uploadfile"]["error"]) {
case UPLOAD_ERR_INI_SIZE:
die("The uploaded file exceeds the upload_max_filesize directive " .
"in php.ini.");
break;
case UPLOAD_ERR_FORM_SIZE:
die("The uploaded file exceeds the MAX_FILE_SIZE directive that " .
"was specified in the HTML form.");
break;
case UPLOAD_ERR_PARTIAL:
die("The uploaded file was only partially uploaded.");
break;
case UPLOAD_ERR_NO_FILE:
die("No file was uploaded.");
break;
case UPLOAD_ERR_NO_TMP_DIR:
die("The server is missing a temporary folder.");
break;
case UPLOAD_ERR_CANT_WRITE:
die("The server failed to write the uploaded file to disk.");
break;
case UPLOAD_ERR_EXTENSION:
die("File upload stopped by extension.");
break;
}
}
//get info about the image being uploaded
$uploadfile = $_POST["uploadfile"];
$image_caption = $_POST["caption"];
$image_username = $_POST["username"];
$image_date = date("Y-m-d");
list($width, $height, $type, $attr) = getimagesize($_FILES["uploadfile"]["tmp_name"]);
// make sure the uploaded file is really a supported image
switch ($type) {
case IMAGETYPE_GIF:
$image = imagecreatefromgif($_FILES["uploadfile"]["tmp_name"]) or
die("The file you uploaded was not a supported filetype.");
$ext = ".gif";
break;
case IMAGETYPE_JPEG:
$image = imagecreatefromjpeg($_FILES["uploadfile"]["tmp_name"]) or
die("The file you uploaded was not a supported filetype.");
$ext = ".jpg";
break;
case IMAGETYPE_PNG:
$image = imagecreatefrompng($_FILES["uploadfile"]["tmp_name"]) or
die("The file you uploaded was not a supported filetype.");
$ext = ".png";
break;
default:
die("The file you uploaded was not a supported filetype.");
}
//insert information into image table
$query = "INSERT INTO images (image_caption, image_username, image_date)
VALUES ('$image_caption.', '$image_username', '$image_date')";
$result = mysql_query($query, $db) or die (mysql_error($db));
//retrieve the image_id that MySQL generated automatically when we inserted
//the new record
$last_id = mysql_insert_id();
//because the id is unique, we can use it as the image name as well to make
//sure we don’t overwrite another image that already exists
$imagename = $last_id.$ext;
// update the image table now that the final filename is known.
$query = "UPDATE images SET image_filename = '.$imagename.'
WHERE image_id = '$last_id'";
$result = mysql_query($query, $db) or die (mysql_error($db));
//save the image to its final destination
switch ($type) {
case IMAGETYPE_GIF:
imagegif($image, $dir . '/' . $imagename);
break;
case IMAGETYPE_JPEG:
imagejpeg($image, $dir . '/' . $imagename, 100);
break;
case IMAGETYPE_PNG:
imagepng($image, $dir . '/' . $imagename);
break;
}
imagedestroy($image);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Here's your pic</title>
</head>
<body>
<h1> So how does it feel to be famous? </h1 >
<p> Here is the picture you just uploaded to our servers: </p >
<img src="images/ <?php echo $imagename; ?>" style="float:left;">
<table>
<tr> <td> Image Saved as: </td> <td> <?php echo $imagename; ?> </td> </tr>
<tr> <td> Image Type: </td> <td> <?php echo $ext; ?> </td> </tr>
<tr> <td> Height: </td> <td> <?php echo $height; ?> </td > </tr>
<tr> <td> Width: </td> <td> <?php echo $width; ?> </td > </tr>
<tr> <td> Upload Date: </td > <td > <?php echo $image_date; ?> </td > </tr>
</table>
</body>
</html>

 

Now, the image_filename is no longer empty on the table..its now actually showing the image_filename, but the only  problem here now is displaying on the html page..its still showing the "X" thing rather than the real image uploaded to the folder.  What am I getting wrong this time?

<img src="images/ <?php echo $imagename; ?>" style="float:left;">

 

^^^ The URL in the src="..." attribute must be to where the image files are located.

 

If that script is in your WroxPhp6.0 folder, then the above code should be -

<img src="img/<?php echo $imagename; ?>" style="float:left;">

Here's what I tried Pf:

 

<img src="img/<?php echo $imagename; ?>" style="float:left;">

 

and

 

 

<img src="img/<?php echo $imagename; ?>" style="float:left;">

 

 

and finally,

 

<img src="WroxPhp6.0/img/<?php echo $imagename; ?>

 

 

Wow, men, if these 3 codes rn't wking then I wonder which would get the image displayed.

 

All of these seem to display 2 "X" while the rest of the information of the image displays intact..do u have any better ideas Pf?

I tried the check_image.php code with the suggested change and it worked as expected.

 

There is however another error in the UPDATE query. There are two extra dots, one before and one after the $imagename that is being stored in the table.

ok pf here's my final code:

 

upload_image.php

<?php
$db = mysql_connect("localhost","root","") or
die ("Unable to connect. Check your connection parameters.");
mysql_select_db("moviesite", $db) or die(mysql_error($db));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>upload_image</title>
</head>

<body>
<form action="check_image.php" method="post" enctype="multipart/form-data">
<table>
<tr>
<td> Your Username </td>
<td> <input type="text" name="username"/> </td>
</tr>
<td> Upload Image* </td>
<td> <input type="file" name="uploadfile"/> </td>
</tr> <tr>
<td colspan="2">
<small> <em> * Acceptable image formats include: GIF, JPG/JPEG and PNG.
</em> </small>
</td>
</tr> <tr>
<td> Image Caption <br/>
</td>
<td> <input type="text" name="caption" /> </td>
</tr > <tr>
<td colspan="2" style="text-align: center">
<input type="submit" name="submit" value="Upload"/>
</td>
</tr>
</table>
</form>
</body>
</html>

 

check_image.php

<?php
$db = mysql_connect("localhost","root","") or
die ("Unable to connect. Check your connection parameters.");
mysql_select_db("moviesite", $db) or die(mysql_error($db));

//change this path to match your images directory
$dir ="C:/xampp/htdocs/WroxPhp6.0/img";
//make sure the uploaded file transfer was successful

if ($_FILES["uploadfile"]["error"] != UPLOAD_ERR_OK) {
switch ($_FILES["uploadfile"]["error"]) {
case UPLOAD_ERR_INI_SIZE:
die("The uploaded file exceeds the upload_max_filesize directive " .
"in php.ini.");
break;
case UPLOAD_ERR_FORM_SIZE:
die("The uploaded file exceeds the MAX_FILE_SIZE directive that " .
"was specified in the HTML form.");
break;
case UPLOAD_ERR_PARTIAL:
die("The uploaded file was only partially uploaded.");
break;
case UPLOAD_ERR_NO_FILE:
die("No file was uploaded.");
break;
case UPLOAD_ERR_NO_TMP_DIR:
die("The server is missing a temporary folder.");
break;
case UPLOAD_ERR_CANT_WRITE:
die("The server failed to write the uploaded file to disk.");
break;
case UPLOAD_ERR_EXTENSION:
die("File upload stopped by extension.");
break;
}
}
//get info about the image being uploaded
$uploadfile = $_POST["uploadfile"];
$image_caption = $_POST["caption"];
$image_username = $_POST["username"];
$image_date = date("Y-m-d");
list($width, $height, $type, $attr) = getimagesize($_FILES["uploadfile"]["tmp_name"]);
// make sure the uploaded file is really a supported image
switch ($type) {
case IMAGETYPE_GIF:
$image = imagecreatefromgif($_FILES["uploadfile"]["tmp_name"]) or
die("The file you uploaded was not a supported filetype.");
$ext = ".gif";
break;
case IMAGETYPE_JPEG:
$image = imagecreatefromjpeg($_FILES["uploadfile"]["tmp_name"]) or
die("The file you uploaded was not a supported filetype.");
$ext = ".jpg";
break;
case IMAGETYPE_PNG:
$image = imagecreatefrompng($_FILES["uploadfile"]["tmp_name"]) or
die("The file you uploaded was not a supported filetype.");
$ext = ".png";
break;
default:
die("The file you uploaded was not a supported filetype.");
}
//insert information into image table
$query = "INSERT INTO images (image_caption, image_username, image_date)
VALUES ('$image_caption.', '$image_username', '$image_date')";
$result = mysql_query($query, $db) or die (mysql_error($db));
//retrieve the image_id that MySQL generated automatically when we inserted
//the new record
$last_id = mysql_insert_id();
//because the id is unique, we can use it as the image name as well to make
//sure we don’t overwrite another image that already exists
$imagename = $last_id.$ext;
// update the image table now that the final filename is known.
$query = "UPDATE images SET image_filename = '$imagename'
WHERE image_id = '$last_id'";
$result = mysql_query($query, $db) or die (mysql_error($db));
//save the image to its final destination
switch ($type) {
case IMAGETYPE_GIF:
imagegif($image, $dir . '/' . $imagename);
break;
case IMAGETYPE_JPEG:
imagejpeg($image, $dir . '/' . $imagename, 100);
break;
case IMAGETYPE_PNG:
imagepng($image, $dir . '/' . $imagename);
break;
}
imagedestroy($image);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Here's your pic</title>
</head>
<body>
<h1> So how does it feel to be famous? </h1 >
<p> Here is the picture you just uploaded to our servers: </p >
<table>
<tr> <td> Image Saved as: </td> <td> <img src="img/<?php $imagename; ?>" style="float:left;"> </td> </tr>
<tr> <td> Image Type: </td> <td> <?php echo $ext; ?> </td> </tr>
<tr> <td> Height: </td> <td> <?php echo $height; ?> </td > </tr>
<tr> <td> Width: </td> <td> <?php echo $width; ?> </td > </tr>
<tr> <td> Upload Date: </td > <td > <?php echo $image_date; ?> </td > </tr>
</table>
</body>
</html>

 

I really dont get why this image is showing x. I have removed the dots at the update image (like u indicated) but the image is still not displaying. What is wrong with this modified code?

perhaps change this

 

<tr> <td> Image Saved as: </td> <td> <img src="img/<?php $imagename; ?>" style="float:left;"> </td> </tr>

 

to this

<tr> <td> Image Saved as: </td> <td> <img src="img/<?php echo $imagename; ?>" style="float:left;"> </td> </tr>

I can see his post OK (using Firefox - latest).

 

I'm guessing that the hacker who broke into the forum and modified it forgot that this is a programming help forum and being able to actually see what was posted is kind of important to asking for and giving help.

 

His post is pointing out that you removed the echo statement that was before the $imagename; in the src="..." attribute. Why did you do that?

Hey, pf glad to have u back men.. here's my check_image.php:

 

<?php
$db = mysql_connect("localhost","root","") or
die ("Unable to connect. Check your connection parameters.");
mysql_select_db("moviesite", $db) or die(mysql_error($db));

//change this path to match your images directory
$dir ="C:/xampp/htdocs/WroxPhp6.0/images";
//make sure the uploaded file transfer was successful

if ($_FILES["uploadfile"]["error"] != UPLOAD_ERR_OK) {
switch ($_FILES["uploadfile"]["error"]) {
case UPLOAD_ERR_INI_SIZE:
die("The uploaded file exceeds the upload_max_filesize directive " .
"in php.ini.");
break;
case UPLOAD_ERR_FORM_SIZE:
die("The uploaded file exceeds the MAX_FILE_SIZE directive that " .
"was specified in the HTML form.");
break;
case UPLOAD_ERR_PARTIAL:
die("The uploaded file was only partially uploaded.");
break;
case UPLOAD_ERR_NO_FILE:
die("No file was uploaded.");
break;
case UPLOAD_ERR_NO_TMP_DIR:
die("The server is missing a temporary folder.");
break;
case UPLOAD_ERR_CANT_WRITE:
die("The server failed to write the uploaded file to disk.");
break;
case UPLOAD_ERR_EXTENSION:
die("File upload stopped by extension.");
break;
}
}
//get info about the image being uploaded
$uploadfile = $_POST["uploadfile"];
$image_caption = $_POST["caption"];
$image_username = $_POST["username"];
$image_date = date("Y-m-d");
list($width, $height, $type, $attr) = getimagesize($_FILES["uploadfile"]["tmp_name"]);
// make sure the uploaded file is really a supported image
switch ($type) {
case IMAGETYPE_GIF:
$image = imagecreatefromgif($_FILES["uploadfile"]["tmp_name"]) or
die("The file you uploaded was not a supported filetype.");
$ext = ".gif";
break;
case IMAGETYPE_JPEG:
$image = imagecreatefromjpeg($_FILES["uploadfile"]["tmp_name"]) or
die("The file you uploaded was not a supported filetype.");
$ext = ".jpg";
break;
case IMAGETYPE_PNG:
$image = imagecreatefrompng($_FILES["uploadfile"]["tmp_name"]) or
die("The file you uploaded was not a supported filetype.");
$ext = ".png";
break;
default:
die("The file you uploaded was not a supported filetype.");
}
//insert information into image table
$query = "INSERT INTO images (image_caption, image_username, image_date)
VALUES ('$image_caption.', '$image_username', '$image_date')";
$result = mysql_query($query, $db) or die (mysql_error($db));
//retrieve the image_id that MySQL generated automatically when we inserted
//the new record
$last_id = mysql_insert_id();
//because the id is unique, we can use it as the image name as well to make
//sure we don’t overwrite another image that already exists
$imagename = $last_id.$ext;
// update the image table now that the final filename is known.
$query = "UPDATE images SET image_filename = '$imagename'
WHERE image_id = '$last_id'";
$result = mysql_query($query, $db) or die (mysql_error($db));
//save the image to its final destination
switch ($type) {
case IMAGETYPE_GIF:
imagegif($image, $dir . '/' . $imagename);
break;
case IMAGETYPE_JPEG:
imagejpeg($image, $dir . '/' . $imagename, 100);
break;
case IMAGETYPE_PNG:
imagepng($image, $dir . '/' . $imagename);
break;
}
imagedestroy($image);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Here's your pic</title>
</head>
<body>
<h1> So how does it feel to be famous? </h1 >
<p> Here is the picture you just uploaded to our servers: </p >
<img src="images/<?php echo $imagename; ?>" style="float:left;">
<table>
<tr> <td> Image Saved as: </td> <td><?php echo $imagename; ?></td> </tr>
<tr> <td> Image Type: </td> <td> <?php echo $ext; ?> </td> </tr>
<tr> <td> Height: </td> <td> <?php echo $height; ?> </td > </tr>
<tr> <td> Width: </td> <td> <?php echo $width; ?> </td > </tr>
<tr> <td> Upload Date: </td > <td > <?php echo $image_date; ?> </td > </tr>
</table>
</body>
</html>

 

As u can see I'm using

</td> <td><?php echo $imagename; ?></td> </tr>

 

and its still not dispaying any other thing than "X"..any other suggestions?

What does your source say? (use the page/view source in your browser)

 

Here's what it says:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Here's your pic</title>
</head>
<body>
<h1> So how does it feel to be famous? </h1 >
<p> Here is the picture you just uploaded to our servers: </p >
<img src="images/" style="float:left;">
<table>
<tr> <td> Image Saved as: </td> <td>4.jpg</td> </tr>
<tr> <td> Image Type: </td> <td> .jpg </td> </tr>
<tr> <td> Height: </td> <td> 400 </td > </tr>
<tr> <td> Width: </td> <td> 620 </td > </tr>
<tr> <td> Upload Date: </td > <td > 2010-10-03 </td > </tr>
</table>
</body>
</html>

Using <p> Here is the picture you just uploaded to our servers: </p >

<img src="images/<?php echo $imagename; ?>" style="float:left;">, in dreamweaver it then shows the code below in the view source.

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Here's your pic</title>
</head>
<body>
<h1> So how does it feel to be famous? </h1 >
<p> Here is the picture you just uploaded to our servers: </p >
<img src="images/5.jpg" style="float:left;">
<table>
<tr> <td> Image Saved as: </td> <td>5.jpg</td> </tr>
<tr> <td> Image Type: </td> <td> .jpg </td> </tr>
<tr> <td> Height: </td> <td> 400 </td > </tr>
<tr> <td> Width: </td> <td> 620 </td > </tr>
<tr> <td> Upload Date: </td > <td > 2010-10-03 </td > </tr>
</table>
</body>
</html>

  • 1 month later...
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.