cffile upload
I have following code to use cffile upload a file.
I am able to upload the file from client machine to server machine.
The only thing is after upload file, browser refresh my screen using url string without paramer like
http://www.myserver.com/myapp.cfm
but my original url is
http://www.myserver.com/myapp.cfm?MyParam=1
because it change url string, the browser data refresh, no more their and it does not recognize paramter either that I can not save information to database.
I would like to know if there is any configuration need to do or coding to make file upload keep on the same screen or I have to have a separate form to upload the file.
Your help and information is great appreciated,
Regards,
Iccsi,
client side code:
<cfinput type="file" name="fleAttachment" id="filAttachment" >
<cfinput type="submit" name="btnAttach" id="btnAttache" value="upload">
<cfif isdefined("MyUpload")>
file uploaded!
</cfif>
here is server side code:
<cfif isdefined("btnAttach") and isdefined("fleAttachment")>
<cfset UploadFolder = "#application.upload_folder#" & "#form.MyParam#">
<cfif Not DirectoryExists("#UploadFolder#")>
<cfdirectory action = "create" directory="#UploadFolder#" />
</cfif>
<cffile action="UPLOAD" filefield="fleAttachment" destination="#UploadFolder#"
accept ="application/pdf, application/msword, application/vnd.ms-excel, text/plain" nameconflict="MAKEUNIQUE"
result="MyUpload">
here is Application.cfc to get application upload folder.
<cfset thisPath=ExpandPath("*.*")>
<cfset application.upload_folder=GetDirectoryFromPath(thisPath) & "Attachment\">
