I think what Dave meant was to have 2 form fields. The file field and a text
field. The text field can be used to name the file to whatever they want,
hit the upload button and:

<cffile action="upload" uploads the file
<cffile action="rename" renames the file

All in one processing page. SO there is no need to have to come back to the
file after the fact just to rename it.

Probably irrelevant but I usually name files with numeric values that match
their ID's in a database (or something like 'MMDDYYYYHHMMSS' from the
current date and time) and save the original file name for display purposes
only. If the user wants to change the name of the file, they are actually
just changing data that is used only for display. Make sense?

So if I uploaded "Some_File.pdf", it would be renamed to something like
001.pdf. the text "Some_File.pdf" would go into a field in the database
along with the new files name.

FiledID = 1
FileName = 001.pdf
DisplayName = Some_File.pdf

And a link to the file would look something like...

<a href="#path#/#FileName#" title="#DisplayName#">#DisplayName#</a>
Equating to...
<a href="/www/files/001.pdf" title="Some_File.pdf">Some_File.pdf</a>

Now if I wanted to "change the name of the file", I would change
"Some_File.pdf" to "whatever.pdf" and the link becomes:

<a href="/www/files/001.pdf" title="whatever.pdf">whatever.pdf</a>

The file is still really named 001.pdf. No harm, no foul. They can "rename"
the file all day long and you don't have to worry about checking for
duplicate names or files becoming corrupt during the change.



-----Original Message-----
From: Adkins, Randy [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 25, 2005 4:11 PM
To: CF-Talk
Subject: RE: File Uploading using CF

Yeah I was sure it was not able to be done that way just needed to
re-confirm.
I proposed the renaming of the file after the upload is completed which
is
Simple and would be basically the same thing.  

-----Original Message-----
From: Dave Watts [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 25, 2005 4:17 PM
To: CF-Talk
Subject: RE: File Uploading using CF

> I think I know the answer to this but tossing it out here anyway.
>  
> I have a client who wants to be able to upload files to the server.
> No Problem right! Easy enough...
>  
> However, they want to be able to hit the Browse button, get the file 
> and once it is populate in the input field (FILE), it should be 
> renamed.
>  
> My thought is that with CF that when uploading files it would look for

> the input field for FILE to process the upload. Even if the true path 
> and file was put to a hidden field and the FILE field was renamed, 
> which would CF process the upload for?
>  
> I know with the CFFILE tag it asks for the field, has anyone specified

> a hidden field other than the one on the form?
>  
> Can this be done with straight forward CF and JS or would this call 
> for a COM object?

You typically don't have much control over how files are uploaded within
HTML forms, for obvious reasons. Why not just add a new text field to
let them type in the name they want to give the file, and name it that
once the file is uploaded?

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta, Chicago,
Baltimore, Northern Virginia, or on-site at your location. 
Visit http://training.figleaf.com/ for more information!






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:200086
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to