Re: Re: is there any syntax to save a file in mysql?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2011-03-28 at 18:18 +0430, Negin Nickparsa wrote:

> storing what in db?
> my codes was abt to store the file when uploading what is the difference
> can i give me in an example?


When you copy the file use code like:

move_uploaded_file($_FILES['image']['tmp_name'],
$_FILES['image']['tmp_name']);

adding in any path information you need. I've assumed your input element
is called 'image' here.

Then make a query call, with various fields you will need at a later
date:

$sql = "INSERT INTO files (original_name, temp_name, etc) VALUES
('{$_FILES['image']['name']}', '{$_FILES['image']['tmp_name']}', etc)";
$result = mysql_query($sql);

You'll need to refine the code a bit, but the basics are here. You can
then use queries later to retrieve what files are available to what user
based on the other fields you filled in with this query.

Thanks,
Ash
http://www.ashleysheridan.co.uk



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux