Brian,
Here is the code I am using:
<script language="JavaScript">
function parseFileName(theFile)
{
var start = -1;
while (theFile.value.indexOf("\\", start + 1) != -1)
{
start = theFile.value.indexOf("\\", start + 1);
}
FileUpload.action = FileUpload.action + theFile.value.substring(start+1,
theFile.value.length);
}
</script>
</head>
<body>
<form id="FileUpload" name="FileUpload" title="Form to upload a file from the user to
the server" action="FileUpload.cfm?FileName=" method="post"
enctype="multipart/form-data" onsubmit="validateForm(this)">
<label id="UploadFileLabel" title="Lebel for UploadFile Input" for="UploadFile">
Select your file
</label>
<input id="UploadFile" name="UploadFile" title="File to be uploaded" type="file"
onchange="parseFileName(this)">
<br>
<button id="UploadButton" name="UploadButton" title="Button to start the Upload"
type="submit">
Upload
</button>
</form>
Then in fileupload.cfm I have:
<cfset uploadPath = Left(PATH_TRANSLATED, Find("FileUpload.cfm", PATH_TRANSLATED)-1)
& "UploadFiles\">
<cffile action="upload" destination="#uploadPath#" filefield="UploadFile"
nameconflict="makeunique" attributes="readonly">
It is working for me. I hope this helps.
Take care,
Robert
---------- Original Message ----------------------------------
From: "Yager, Brian T Contractor/Sverdrup" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Date: Tue, 8 Oct 2002 15:11:09 -0500
>I am trying to upload a file using CFFILE. I can get it to wrok just fine. But
>what I can't do is get the name of the file BEFORE I use CFFILE. When I try to
>output the name of the file input box, I get some weird name with an extension
>of .tmp. Can anyone help me with what I need please?
>
>Thanks,
>
>Brian Yager
>President - North AL Cold Fusion Users Group
>http://www.nacfug.com
>Sr. Systems Analyst
>Sverdrup/CIC
>[EMAIL PROTECTED]
>(256) 842-8342
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.cfm