Try this:

<@EXCLUDE>
<@ASSIGN local$CGIPostArgs "<@CGIPARAM POST_ARGS>">
<@SCRIPT SCOPE="LOCAL">
function GetUploadFileName(FileNameArg)
{
        var CGIPostArgs = server.getVariable("CGIPostArgs", "local");
        var strFileName = "";
        
        // Determine boundary string by finding first
"Content-Disposition"
        var lngCDPos = CGIPostArgs.indexOf("Content-Disposition");
        
        if (lngCDPos != -1)
        {
                // Extract boundry string
                var strBoundry = CGIPostArgs.substring(0, lngCDPos +
20);
                
                // Create identification string for file name argument
                var strArgID = strBoundry + " form-data; name=\"" +
FileNameArg + "\"; filename=\"";
                
                // Locate starting position of filename by finding
identification string
                var lngStartPos = CGIPostArgs.indexOf(strArgID) +
strArgID.length;
                
                // Locate end position of filename by finding
terminating double quote
                var lngEndPos = CGIPostArgs.indexOf("\"", lngStartPos);
                
                // Extract upload filename for given argument
                strFileName = CGIPostArgs.substring(lngStartPos,
lngEndPos);
        }
        
        return strFileName;
}
</@SCRIPT>
</@EXCLUDE>

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Chris Smith
Sent: Sunday, September 29, 2002 4:21 PM
To: Multiple recipients of list witango-talk
Subject: Re: Witango-Talk: 2nd request: file upload, capture name ?
ASAP!


I've found this approach to work well.

<HEAD>
<SCRIPT LANGUAGE="JavaScript">
 <!-- Begin
 function ParseFileName()
{
   SplitThisStr = document.FORM_NAME.FILENAME.value;
   // create array from delimited string
   SplitArray = SplitThisStr.split("\\");
   // how many items in array
   LastIteminArray = SplitArray.length;
   // get the file name
   JustFileName = SplitArray[LastIteminArray-1];
   // set the hidden input value
   document.FORM_NAME.JustTheFileName.value = JustFileName;
}
//  End -->
</script>
 </HEAD>

<form name="FORM_NAME" action="MEWSPLITTEST.cfm" method="post" >
   file name<input type="file" name="FILENAME" value="" size="50"
maxlength="50" onChange="ParseFileName()"><br>
   <input type="hidden" name="JustTheFileName" value="">
   <input type="submit">
</form>

csmith
----- Original Message ----- 
From: "Ben Johansen" <[EMAIL PROTECTED]>
To: "Multiple recipients of list witango-talk"
<[EMAIL PROTECTED]>
Sent: Friday, September 27, 2002 4:22 PM
Subject: RE: Witango-Talk: 2nd request: file upload, capture name ?
ASAP!


> Mange Tak ;-)
> 
> Ben Johansen - http://www.pcforge.com
> Authorized Witango Reseller http://www.pcforge.com/WitangoGoodies.htm
> Latest downloads & List Archives @ http://www.witango.ws
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]] On Behalf Of Beverly Voth
> Sent: Friday, September 27, 2002 12:13 PM
> To: Multiple recipients of list witango-talk
> Subject: RE: Witango-Talk: 2nd request: file upload, capture name ? 
> ASAP!
> 
> Mais oui! Merci,
> Beverly
> 
> 
> Hello, Richard Wan! On 9/27/2002 3:07 PM -0400, you wrote in whole or
> part:
> >Just tokenize on the "/" and take the last element
> >
> >-----Original Message-----
> >From: [EMAIL PROTECTED] 
> >[mailto:[EMAIL PROTECTED]]On Behalf Of Beverly Voth
> >Sent: Friday, September 27, 2002 2:58 PM
> >To: Multiple recipients of list witango-talk
> >Subject: RE: Witango-Talk: 2nd request: file upload, capture name ? 
> >ASAP!
> >
> >
> >Hello, Ben Johansen! On 9/27/2002 11:13 AM -0700, you wrote in whole 
> >or
> >part:
> >><SCRIPT language="JavaScript">
> >><!--
> >>function getNames()
> >>{
> >>document.LoadFiles.TextName.value = document.LoadFiles.text.value; 
> >>document.LoadFiles.LinkDocName.value =
> document.LoadFiles.linkDoc.value;
> >>return true;
> >>}
> >>-->
> >></SCRIPT>
> >>
> >>Now when you submit the names will be placed in the hidden tags for
> you
> >>to reference.
> >
> >
> >OOPs! this returns the entire path to me. I just need the file names.
> >
> >Thanks,
> >Beverly 
> >_____________________________________________________________________
> >__
> _
> >TO UNSUBSCRIBE: send a plain text/US ASCII email to
> [EMAIL PROTECTED]
> >                with unsubscribe witango-talk in the message body
> >
> >_____________________________________________________________________
> >__
> _
> >TO UNSUBSCRIBE: send a plain text/US ASCII email to
> [EMAIL PROTECTED]
> >                with unsubscribe witango-talk in the message body
> 
> ______________________________________________________________________
> __
> TO UNSUBSCRIBE: send a plain text/US ASCII email to
[EMAIL PROTECTED]
>                 with unsubscribe witango-talk in the message body
> 
> ______________________________________________________________________
> __
> TO UNSUBSCRIBE: send a plain text/US ASCII email to
[EMAIL PROTECTED]
>                 with unsubscribe witango-talk in the message body

________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
                with unsubscribe witango-talk in the message body

________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
                with unsubscribe witango-talk in the message body

Reply via email to