Jump to content

PHP script for upload file dispaly


mulazim

Recommended Posts

download.php page

 

$query = "SELECT id, name FROM tablename";

$result = mysql_query($query) or die('Error, query failed');

if(mysql_num_rows($result) == 0)

{

echo "Database is empty <br>";

}

else

{

while(list($imageid, $fieldname) = mysql_fetch_array($result))

{

?>

<a href="download.php?id=<?php echo $imageid;?>"><?php echo  $fieldname;?></a> <br>

<?php

}

}

this query is option to save  and open image ....

<? if(isset($_GET['imageid']))

{

 

 

$id = $_GET['imageid'];

$query = "SELECT fieldname FROM tablename WHERE id = '$id'";

$result = mysql_query($query) or die('Error, query failed');

list($fieldname) = mysql_fetch_array($result);

$filepath="imagepath ";

header("Content-type: application/octet-stream");

header("Content-Disposition: attachment; filename=$fieldname");

header( "X-LIGHTTPD-send-file:  . $filepath");

@readfile($file);

Archived

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

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