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

From: Date: Mon, 28 Mar 2011 12:53:24 +0000
Subject: Re: Re: is there any syntax to save a file in mysql?
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.general 
Request: Send a blank email to php-general+get-312093@lists.php.net to get a copy of this message
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

« previous php.general (#312093) next »