Saving a file to my server
Posted: Sun May 03, 2009 4:45 pm
Hi there
I currently have this code that takes a file from a SQL database and lets you download. I want o create a zip file with many files in it so I need to save these files to a server.
How do I do this?
Currently I have this code
I currently have this code that takes a file from a SQL database and lets you download. I want o create a zip file with many files in it so I need to save these files to a server.
How do I do this?
Currently I have this code
Code: Select all
<?php
mysql_connect("localhost","root","");
mysql_select_db("test");
$query = "SELECT data,filename,filetype FROM uploads where id=$id";
$result = MYSQL_QUERY($query);
$data = MYSQL_RESULT($result,0,"data");
$type = MYSQL_RESULT($result,0,"filetype");
$name = MYSQL_RESULT($result,0,"filename");
$names = str_replace(' ', '_', $name);
Header( "Content-type: $type");
Header("Content-Disposition: attachment; filename=$names");
print $data;
//echo $name;
?>