If you want to capture the name of the file in an input type="file", you
have to write a javascript event that fires on the input field... copying
the filename to a hidden field. This *can* happen before you perform the
upload. 

I do not know if you will ultimately be able to do the cfmail mime-attach,
though.  You might have to do the upload first.

Here's an example:

function copy2hidden(filefield) {               //filefield parameter is the
file html element

                if (filefield.value.length != 0) {                      //
filefiled must have content
                        //alert(filefield.value)
        
document.forms["uploadfile_pickfile"].fullfilename.value = filefield.value;
// set hidden field with name of file
        
//alert(document.forms["uploadfile_pickfile"].fullfilename.value)
                } 
        }

<form name="uploadfile_pickfile" action="..." method="post">
        <input type="file" name="file" value=""
onClick="loadfilelist(destination.value)" readonly="1">
</form>


|-----Original Message-----
|From: Wilson, Craig [mailto:[EMAIL PROTECTED]]
|Sent: Friday, March 09, 2001 7:55 AM
|To: CF-Talk
|Subject: input type="file"
|
|
|After using the following code to browse for a file (thanks Philip),
|
|<form action="myPage.cfm" method="post" ENCTYPE="multipart/form-data">
|<input type="file" name="myFile">
|<input type="submit">
|</form>
|
|I want to use the variable #FORM.MYFILE# to form part of a 
|CFMAIL command
|using mimeattach :
|
|<cfmail                to="smtp.address" 
|               subject="Submit Problem"
|               mimeattach="#form.myfile#" 
|               from="#client.mailbox#">In #form.field1#,
|#form.field2#</cfmail>
|
|
|For some reason (in my example I used a text file), it renders 
|the contents
|of the text document on the action page in full and doesn't 
|interpret the
|file name as a string which is what I would hope it would do.
|
|Can anyone help?
|
|
|
|
|***************************************************************
|*******************
|
|The opinions expressed in this E-mail are those  of  the 
|individual  and
|not  necessarily  the  company.  This E-mail and  any files 
|transmitted 
|with it are confidential and solely for the use of the 
|intended recipients
|
|***************************************************************
|*******************
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to