Re: Upload a file into DB



On 29 Jun 2006 02:54:36 -0700, "yonthebeach@xxxxxxxxxxxxxx"
<yonthebeach@xxxxxxxxxxxxxx> wrote:

how can i upload a file with PHP into my database, and allow a download
of the file on the frontend (sent to client). Do i upload then into a
BLOB field?

Yes, BLOB is the usual name for the appropriate data type. But it depends on
what database you're using.

For downloads you either stream it out as the results of a query, or you write
it to a file and let the webserver serve that file, using the filesystem as a
cache, but keeping the database as the master, so you only need to backup the
database and not the filesystem copy.

And how to check for a max filesize (max. 1MB) and if its
bigger cancel operation.

http://uk.php.net/manual/en/features.file-upload.php

--
Andy Hassall :: andy@xxxxxxxxxxx :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
.



Relevant Pages

  • Jakarta Commons FileUpload - Files only partially stored to BLOB
    ... I configure file upload as follows: ... when I retrieve the file that was written to a Blob field in ... I've isolated the problem to the write to database rather than the ... A FileItem object called file is passed in to the method. ...
    (comp.lang.java.programmer)
  • RE: [PHP] Uploaded images
    ... I would like to know how to insert uploaded fileinto database ... As I upload the file, ... I programme expect uploading of huge amount of images and pictures, ... How about storing the images in the filesystem but organizing their locations using the database? ...
    (php.general)
  • Re: reiser4 plugins
    ... > an entire new storage array and this wasn't/isn't cheap. ... > following versions of an article; reduced the database by 85%). ... So a filesystem with intelligent ... Any "unnecessary double work" would squarely be within ReiserFS... ...
    (Linux-Kernel)
  • Re: [RFC] Linux Kernel Subversion Howto
    ... - you only have a filesystem that supports 8.3 file names, ... This was the clever trick I alluded to. ... > why aren't you telling Oracle to disclose how Oracle works inside? ... stored in the database for itself, ...
    (Linux-Kernel)
  • Re: [PHP] Re: how to display images stored in DB
    ... To follow up with Ted, nobody said using the filesystem is bad, ... many of us are saying is that the database is not necessarily bad ... Think of the UNIX file systems, ... he argues in favour of the irrefutability of his argument only needs one ...
    (php.general)