I'm
pretty sure there's a file size limit as to how much you can store in the
database. You will obviously cause some overhead when loading these files from
the server as compared to loading natively through just iis. You will also ramp
your database file size. In general I find it a very bad idea. Other than it
being the easy solution as you put it, I'm not really seeing the rough part of
the tradeoff of just saving the path to the images. I don't see it as being a
complex algorithm to make all the files unique when cffile already has the nice
feature of makeunique for naming conflicts, unless you are wanting to save it
with a relatively similar name as the makeunique likes to make up it's own, but
then you'd just have to get cffile.serverfile and save it in the database. The
only other problem I could possibly forsee is if the whole app or file server
picks up and moves, then the paths in the database will have to be updated.
Here's the code to upload it to a unique name that's similar to the original if
that helps. Also, MX by default uses very similar logic to uniquely name
uploaded files by default so you don't even have to worry about
it.
<cffile action="" filefield="someformfield"
destination="#path#"
nameconflict="MAKEUNIQUE">
<cfset wanted = cffile.clientfilename> <cfset ext = cffile.clientfileext> <cfset attempt = wanted> <cfif cffile.serverfilename is not wanted> <cfset try = 1> <cfset saved = cffile.serverfile> <cfloop condition="fileexists('#path##attempt#.#ext#')"> <cfset attempt="#wanted##try#"> <cfset try = try + 1> </cfloop> <cffile action="" source="#path##saved#" destination="#path##attempt#.#ext#"> </cfif> <cfset form.someformfield= "#attempt#.#ext#">
|
- [KCFusion] storing files Adaryl Wakefield
- Re: [KCFusion] storing files Dunwiddie, Bruce
- Re: [KCFusion] storing files Adaryl Wakefield
- RE: [KCFusion] storing files Greenhagen, Robin
- RE: [KCFusion] storing files Dunwiddie, Bruce
- Re: [KCFusion] storing files Jim Hrdy
- [KCFusion] Macromedia Flash Remoting Update Bradley Miller