Forum Moderators: open
id INT(4) NOT NULL AUTO_INCREMENT PRIMARY KEY,
category CHAR(5), (a numeric value)
submitter CHAR(50), (person who uploads document)
doc_url CHAR(50), (url related to document)
dato DATETIME, (date document uploaded)
times_down INT(5), (times document downloaded)
extra CHAR(150), (if I ever need more attributes)
bin_data LONGBLOB, (the four last for the document itself)
filename CHAR(50),
filesize CHAR(50),
filetype CHAR(50)
Would this do it? And -is it possible to get the date from mysql direct instead of posting it? And will it be difficult to make the stored document downloadable, hopefully with an ID or something similar and never the document name in the download url?
you can use the TIMESTAMP column type in mysql to automatically update the column to the current time upon insert or update.
or you can use the NOW() function to valuate the DATETIME column if you prefer.
Regards
Michal
PS. If you wish otherwise, then headers are a must.
I don't recommend this solution - filesystems are better prepared to store files, than db.
i completely agree and sorry if i was unclear.
i wasn't suggesting to store the file content in the db, merely to make the file itself inaccessible to the web.
but then i also hadn't noticed this when i originally replied:
bin_data LONGBLOB, (the four last for the document itself)
so like michal said, use the filesystem for files.
lose the longblob, keep the rest.
read up on using TIMESTAMP and the NOW() function to see what works best for you.
your response should be headers and then a stream of data copied from the file.
as long as your script can read the file and the http server can't you should be ok.