Re: Upload Files!
| From: | Jeremy O'Connor | Date: | Fri, 18 Apr 2008 04:50:46 +0000 |
| Subject: | Re: Upload Files! | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-28867@lists.php.net to get a copy of this message | ||
"Jarrett Meyer" <jmtmeyer@yahoo.com> wrote in message
news:4804BEE3.9010105@yahoo.com...
> Files and all associated properties are saved in the $_FILES[] variable.
> From here, you can get the file name, file size, etc.
>
> I would recommend that you come up with your own name for the file. My
> code may not be right, but it will be close.
>
> $LocalFilePath = /path/to/local/files/
> $LocalFileName = md5($_FILES[<formfield>]["name"]);
>
> // perform an action to save the file locally.
>
> Assuming that you have the user name from the session data,
>
> $Sql = "insert into UserFiles
> (User, Filename, Extension, Date)
> values
> ($_SESSION["user"]
> ,$LocalFileName
> ,$_FILE[<formfield>]["type"]
> ,time())";
>
> Now you've got a database of all files saved by user.
>
> See http://us3.php.net/features.file-upload for more info about
> the
> $_FILES variable.
>
> Jarrett M
>
> Matthew Gonzales wrote:
>> Hello,
>>
>> I am wondering if anyone out might be able to point me in the right
>> direction on uploading files from a website into MySQL Databses. I am
>> trying to create a way for members to upload files and associate them
>> with there user profile. What data type must I use. Thanks for your help
>> in advance.
Also the datatype can be BLOB, MEDIUMBLOB or LONGBLOB.
Jeremy O'Connor
--