Well, one of my users insists he is uploading a pdf, but the file extension
is not getting to the database with the file name, so I just changed it to
#result.serverFileName# which doesn't ever put the file extension  in the
file name column of the database (I have the file extension in another
column)...

Anyway, I still need a way to remove the spaces from a file name.  I'm
guessing a regular expression of some sort.  Will a regular expression do
anything other than tell me if there is a space...it won't remove a space,
will it?

Thanks,

Mark

-----Original Message-----
From: Gerald Guido [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 27, 2008 11:06 AM
To: CF-Talk
Subject: Re: cfFile

Nip it in the bud. Force the user to upload a file with an extension. I have
something that does this that restricts the user to only upload PDF's. BTW I
use the LeftCorner js library... It has a bunch of cf functions translated
to JS.

    <script type="text/javascript" src="js/LeftCorner.js"></script>
    <script type="text/javascript">

    function validate()
    {        var myformvalue = document.myform.resume.value;
            var myformListLen =  LeftCorner.ListLen(myformvalue  , ".");
            var myformextention =
LeftCorner.LCase(LeftCorner.ListGetAt(myformvalue,
myformListLen , "."));

            if (document.myform.resume.value =='')
                {
                   alert('Please select a file to upload.');
                   document.myform.resume.focus();
                   return false;
                }
             if (myformextention !='pdf')
                {

                   alert('Please select a file with "pdf" as the file
extention.\n\nExample: MyResume.pdf\n\n');
                   document.myform.resume.focus();
                   return false;
                }


        return true;
    }
  </script>
    ......
    <form action="#CGI.script_name#" method="post" name="myform"
ONSUBMIT="return validate();" enctype="multipart/form-data">

<input type="file" name="resume" id="resume" value="" />
etc.




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:299983
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to