Re: MySQL Insert via SQL?

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

 



hi!

just a question: don't know it exactly: isn't it possible that the sql-user
on the server may not have enough rights to read the file?

anyway, i would save the file elsewhere on the server, because there are
remarkable performance-issues with big data (tried it once with storing
images for a photo-gallery). it is much faster saving the file in some
directory and just save the path to the file in the db; which on the other
hand, can lead to synchronisation-problems. what do you think about this
topic?

thx -ma

# life would be easier if i knew the source code...

> Von: "John W. Holmes" <holmes072000@xxxxxxxxxxx>
> Antworten an: holmes072000@xxxxxxxxxxx
> Datum: Wed, 07 Jan 2004 21:29:20 -0500
> An: Will W <will.w@xxxxxxxxxxxxxx>
> Cc: PHP DB <php-db@xxxxxxxxxxxxx>
> Betreff: Re:  MySQL Insert
> 
> Will W wrote:
> 
>> Can anyone tell me how to insert a file,
>> say a .doc, .txt or a .rtf file into a table from an upload form??
> 
> How about just this:
> 
> $query = "INSERT INTO Table (orig_name, size, mime_type, data) VALUES
> ('{$_FILES['userfile']['name']}', '{$_FILES['userfile']['size']}',
> '{$_FILES['userfile']['type']}',LOAD_FILE('{$_FILES['userfile']['tmp_name']}')
> )";
> 
> Adapt to your needs. No need for PHP to read the file when you can just
> let MySQL do it. :)
> 
> -- 
> ---John Holmes...
> 
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
> 
> php|architect: The Magazine for PHP Professionals ­ www.phparch.com
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux