RE: File upload and make unique
Robert, At first glance, I thought this would work, but after looking closely at the code, it does nothing more that what makeunique already does, just adds a 1 to the end of the file name if not unique, thus each time you use the routine, you end up with a file name that increases in length by 1 char. I may be able to adapt what you sent, by grabbing the number at the end of upl_fle_nme, taking a val, increment that, and replace the number into the name and then checking for prior existence. So you have still helped me go in the right direction. Jerome -Original Message- From: Robert Harrison [mailto:rob...@austin-williams.com] Sent: Friday, January 09, 2009 12:19 PM To: cf-talk Subject: RE: File upload and make unique Assuming you are uploading from a form and the name of the file field is "file", the routine below will do it. You will need to rename the paths as necessary. This routine will: 1) Rename the file with incremental numbers (1, 2, 3, etc) 2) Ensure the file name uses only standard characters (so it can be used in URL strings if you want to link to the file) 3) Report back the final uploaded file name as the variable "upl_file" 4) Prevent users from uploading dangerous file types (.cfm, .com, .exe, etc.) Hope this helps. |:$'&@,(){}~`^!+;=[]", "", "all")#"> ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317656 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: File upload and make unique
This is what I was looking for thanks! I will study the code and integrate into our website. Thanks again! -Original Message- From: Robert Harrison [mailto:rob...@austin-williams.com] Sent: Friday, January 09, 2009 12:19 PM To: cf-talk Subject: RE: File upload and make unique Assuming you are uploading from a form and the name of the file field is "file", the routine below will do it. You will need to rename the paths as necessary. This routine will: 1) Rename the file with incremental numbers (1, 2, 3, etc) 2) Ensure the file name uses only standard characters (so it can be used in URL strings if you want to link to the file) 3) Report back the final uploaded file name as the variable "upl_file" 4) Prevent users from uploading dangerous file types (.cfm, .com, .exe, etc.) Hope this helps. The file you uploaded uses the extension .#file_ext#. This file type is not allowed. The upload is aborted. Please return and select an acceptable file type or zip the file before uploading. |:$'&@,(){}~`^!+;=[]", "", "all")#"> ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317654 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: File upload and make unique
Assuming you are uploading from a form and the name of the file field is "file", the routine below will do it. You will need to rename the paths as necessary. This routine will: 1) Rename the file with incremental numbers (1, 2, 3, etc) 2) Ensure the file name uses only standard characters (so it can be used in URL strings if you want to link to the file) 3) Report back the final uploaded file name as the variable "upl_file" 4) Prevent users from uploading dangerous file types (.cfm, .com, .exe, etc.) Hope this helps. The file you uploaded uses the extension .#file_ext#. This file type is not allowed. The upload is aborted. Please return and select an acceptable file type or zip the file before uploading. |:$'&@,(){}~`^!+;=[]", "", "all")#"> ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317653 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: File upload and make unique
> We all know that cf8 appends a "1" to the end of the file name to make > a unique new name, which works fine, until the file name gets to 255 > characters. Is there a way to change this behavior? I have a web > application that users check out/in documents and there are some > documents that are heavily used and are reaching a point that the names > no longer work in windows due to the length of the names. Anyone have > any suggestions? Instead of serving the file with the system-generated name, you can just rename it yourself, if you're serving it with CF using the CFCONTENT tag. Keep track of your file names in the database. 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! ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317652 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: File upload and make unique
How are you serving it up to the user? If you use CFHeader / CFContent, you can set the filename: -- Ben Nadel Adobe Community Expert Adobe Certified Advanced ColdFusion Developer Manager New York ColdFusion User Group http://www.bennadel.com Need ColdFusion Help? http://www.bennadel.com/Ask-Ben ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317651 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: File upload and make unique
Rename it before giving it back to them. Not idea, but then you can't control the users OS. Adrian > -Original Message- > From: Huff, Jerome P. [mailto:jerome.h...@ngc.com] > Sent: 09 January 2009 16:05 > To: cf-talk > Subject: RE: File upload and make unique > > No, > Coldfusion is ok, its when the user saves the file to their > local machine, if their local path plus the file name ends up being too > long ... > > > -Original Message- > From: Ben Nadel [mailto:b...@bennadel.com] > Sent: Friday, January 09, 2009 10:58 AM > To: cf-talk > Subject: Re: File upload and make unique > > Are you saying that ColdFusion is throwing errors during the file > upload? Or > is something else going on? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317650 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: File upload and make unique
No, Coldfusion is ok, its when the user saves the file to their local machine, if their local path plus the file name ends up being too long ... -Original Message- From: Ben Nadel [mailto:b...@bennadel.com] Sent: Friday, January 09, 2009 10:58 AM To: cf-talk Subject: Re: File upload and make unique Are you saying that ColdFusion is throwing errors during the file upload? Or is something else going on? -- Ben Nadel Adobe Community Expert Adobe Certified Advanced ColdFusion Developer Manager New York ColdFusion User Group http://www.bennadel.com Need ColdFusion Help? http://www.bennadel.com/Ask-Ben ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317649 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: File upload and make unique
Are you saying that ColdFusion is throwing errors during the file upload? Or is something else going on? -- Ben Nadel Adobe Community Expert Adobe Certified Advanced ColdFusion Developer Manager New York ColdFusion User Group http://www.bennadel.com Need ColdFusion Help? http://www.bennadel.com/Ask-Ben ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317648 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4