Hi all,
Instead of image, always gives empty square with red cross!!!! :'(
why????
I've tried everything... other ways, other foruns, ...
I'm getting crazy!!!!!
will not have to do with the Apache server?
I can not visualize the temporary file on the server, for example "var/www/html/images/phpmYEYF9"
i use a trick...i copy the tmp file "var/www/html/images/phpmYEYF9" that i can not see, to the same place with copy($****,'images/xpto.jpg')
then...well I see the image ... but an image from the database, from the tmp file ... always gives empty square with red cross...
Appreciate your help.
Thanks
JCG
<!--teste.php-->
<?php
ini_set('upload_tmp_dir','/var/www/html/images/');
chmod('/var/www/html/images/', 0777);
$con = mysql_connect('********','*****','******') or die('Erro a ligar SQL!!!'); /* Remote server Apache and MySQL ---- works fine, no errors! */
$db = mysql_select_db('*****') or die('Erro a ligar DB!!!'); /* works fine, no errors! */
$sql = "SELECT foto,id FROM fotos"; /* works fine, no errors! */
$result = mysql_query("$sql") or die("Invalid query: " . mysql_error()); /* works fine, no errors! */
?>
<table border="1"><tr><td>id</td><td>image</td></tr>
<?php
while($row=mysql_fetch_assoc($result)){
print '<tr><td>'.$row['id'].'</td><td>';
print '<img src="show.php?id='.$row['id'].'" height="75" width="100">';
}
echo '</td></tr></table>'
?>
<!--show.php-->
<?php
ini_set('upload_tmp_dir','/var/www/html/images/');
chmod('/var/www/html/images/', 0777);
$con = mysql_connect('********','*****','******') or die('Erro a ligar SQL!!!'); /* Remote server Apache and MySQL ---- works fine, no errors! */
$db = mysql_select_db('*****') or die('Erro a ligar DB!!!'); /* works fine, no errors! */
ob_start();
$query = mysql_query("SELECT foto FROM fotos WHERE id={$_GET['id']}");
$row = mysql_fetch_array($query);
$content = $row['foto'];
header('Content-type: image/jpg');
echo $content;
ob_end_flush();
?>