[development] Files on previews

Craig Courtney craig at dawnsedge.com
Tue Nov 15 15:33:05 UTC 2005

Ber Kessels wrote:

>Hello all files people.
>I am getting somewhere with my files stuff, but i'd like some gurus and/or
>original file.inc developers to comment on an issue:
>We have a lot of code in upload.module and some in file.inc to cater
>previews. In case of a preview, we try to serve the files from the temp
>folder, or we try to generate temporary URLS etc (since we have no nid
>This is a bit crufty IMHO. I want to change this, in my code to behave as
>* A node (or comment or whatever) that has attachements that are valid are
>inserted into the files system all the way. we only leave the obid (the
>column in tghe files dir for object ids like nid) empty
>* invalid files are deleted immediately
>* Once the object is inserted and saved, we have an obid (nid, mostly) and
>we update the table.
>That way, on loads of previews, we should be able to just use the urls,
>apis and functions we use normally.
>Why did we choose for the current method of writing all the exceptions for
>previews? Did I miss something important that renders my idea impossible?
>Should I take care of something else?
Ber you should take a look at the code in my filemanager and attachment 
modules.  They already address this problem and it requires a table to 
keep track of files separately from their association with nodes.  I 
wrote this code a year ago and it was passed over as to complex 
specifically because it actually addressed these issues which where 
ignored by the existing upload module.  These modules have not got much 
love over the last year and may need some feature updates but the 
filemanager does handle exactly the scenarios you are attempting to 
address.  In addition it's handling of temp/active allows editing and 
previews of a node to work with out affecting the existing version until 
the updates are submitted.

Good luck,

More information about the development mailing list