Hi Mariusz, I'd say VARCHAR(255), although even that leads to a sticky issue with DBs, since paths can be of any length up to the system maximum, [which may or may not exist].
It is true that the BLOB type exists in most databases, as a convenience. There may be some cases where the DB would be any appropriate storage option, such as when images contain confidential content and you want the built-in security of DB authorization, rather than leaving the files exposed in the general file system. I guess my general philosophy when choosing applications to handle data, is to look at core competencies rather than features.Consider the name BLOB--it pretty much sums up the DBs view of the data. This can be useful for random binary data, ensure that it is stored and retransmitted properly, but simply adds an unnecessary extra layer to the process when serving up or storing a file in a standard image format. Most systems already have high-quality specialized editors for handling images, and the OS handles file system request much more efficiently than a DB. The core competency of a database is selection by attribute value, generally on records of constant width. The DB specialty skills canbe used to quickly whip out a reference to the file-system location of your image, and the much more direct OS file services can quickly store it or serve it up. Joseph Mariusz wrote: > What type of field should I use for storing the path; just VARCHAR I guess? > And as far as the filenames - make up some random file name for each > submitted file? > > thanks, > Mariusz > > ps. If storing files in the DB is not common, what exactly is the BLOB type > for? > > ----- Original Message ----- > From: "R. Joseph Newton" <[EMAIL PROTECTED]> > To: "Mariusz" <[EMAIL PROTECTED]> > Cc: "perl" <[EMAIL PROTECTED]> > Sent: Thursday, January 09, 2003 2:13 AM > Subject: Re: uploading and downloading files to MySQL > > > Hi Marius, > > > > Why do it? Databases are designed for organization of large table and > information about the relationships between theri attributes. I would > suggest going light, storing only the filename of an image in the db, and > stroing the images files themselves as files. > > > > Joseph > > > > Mariusz wrote: > > > > > Hi, > > > > > > I found some info on how to upload files into a directory on the server > and I was able to do that but can anyone tell me how to upload a file to my > database (MySQL)? I know to use BLOB for the field type (which BLOB > depending on the size) but how do I construct the INSERT or is there a > different special sql command just for that? > > > I will also need the visitor to be able to download that file and > display in the browser (in case of the pic) and download the other type of > files (like music) straight to his hard drive. Basically how can I let a > visitor download the file from my database? > > > > > > I'll also greatly appreciate any pointers to some articles on the net. > > > > > > thank you, > > > Mariusz > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]