Alternatives to CFContent?
I currently store files uploaded to the CMS in a database. My question does not ask for an alternative to that. The problem I have is when serving the file from the public facing web server.
Ideally I can cache the files on the web server i开发者_开发技巧n the file system, but there is a problem with that. The system allows different files to be uploaded with the same filename, and I don't want to cache the files using a UUID or MD5 hash because I want the end user to be able to have the filename in the save dialog.
The issues I have with cfcontent are
- Each and every request to a file loads the file into memory, I don't mind doing this once to build the cache.
- cfcontent does not allow for http download chunking, such that an end user stops downloading a file and later tries to resume it.
- Too many requests to large files will tie up the concurrent requests and force normal page requests into the queue.
P.S. The files are stored in the database because the database is the only form of communication between the CMS and the public site.
Offhand, I'd suggest using the primary key from the db as the directory name, so you can keep the files with the original name, and still store them in a unique location on the server.
So, let's say someone uploads document.docx, and it's assigned the ID 3. Your url would point to /content/3/document.docx or similar.
This is a tough one, as if you have your images in the database, you need some sort of Servlet to make them available to the end Browser. This means, unless your database has some way of exposing images directly to a browser, there has to be some in-memory processing.
You could use cfimage to display it, but I expect it has exactly the same issues you have outlined above.
I had a quick look on Google, but couldn't find anything that specifically met your needs (which is weird, I would have thought there would be something), but it would be easy enough to write up a Servlet and deploy it on JRUN for serving up images using the means in which you want, depending on how good your Java knowledge is.
精彩评论