You can specify the local file name of the uploaded file as it is uploaded,
through the cffile tag's destination="" attribute. It's like this:

<cffile action="upload" destination="#expandPath('.')#/#createUUID()#"
filefield="postfile" result="f">

Good security dictates first that uploaded files should never go in the web
root (even though I'm doing that here), and also that they do not keep the
same filename. You see here that I am giving the file a uuid as its name,
but you can give it a database unique key if you have a record of your
upload, or something else. You can get the name cffile gave it through
#f.serverFile#. Track that name in your database, and the #f.clientFile#
original file name as well. In fact, just <cfdump var="#f#"> to see all
that cffile has.


nathan strutz
[www.dopefly.com] [hi.im/nathanstrutz]


On Thu, Jan 31, 2013 at 9:12 AM, Robert Harrison <rob...@austin-williams.com
> wrote:

>
> Before I go nuts trying to write a fix for this, I'm hoping maybe someone
> will know of a simple solution. Seems like it should be simple.
>
> I use CFFILE to allow user to upload files to our extranet. Our server is
> windows based, so it does not support all of the file characters supported
> on the Mac. A MAC client was trying to upload a file named:
>
>         S107-CounterCard:GiftSheet.indd4.zip
>
> Because of the : in the file name the upload bombed.  I had him rename the
> file to:
>
>         S107-CounterCard-GiftSheet-indd4.zip
>
> and that worked fine.
>
> Question is:  Is there some simple thing I should be doing to avoid this
> that I'm missing?
>
> Thanks,
> Robert
>
> Robert Harrison
> Director of Interactive Services
>
> Austin & Williams
> Advertising I Branding I Digital I Direct
> 125 Kennedy Drive,  Suite 100   I  Hauppauge, NY 11788
> T 631.231.6600 X 119   F 631.434.7022
> http://www.austin-williams.com
>
> Blog:      http://www.austin-williams.com/blog
> Twitter:  http://www.twitter.com/austi
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:354202
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to