Click to See Complete Forum and Search --> : Please Be Kind And Save My Life


Nick
03-06-2003, 01:38 AM
Hi,
I am absolutely new to ColdFusion. I am stuck in the middle and please need help. I implemented a cfquery and
that is working. This query returns all these files ( this.doc, file.txt, Book.xls, report.doc ) . This would be used
by only few handfuls of people within an organization. All of them are using company INTRANET and IE.

a) My question is can I implement a script that would give users option to save all the files at once in their
specific folder or disk. This is basically to save all those files returned by the Query in the users hard drive or
network folder within the company. Any script or any program will do this?

I coded following please take a look.

My query works fine.


*** Also implemented some logic to call <cffile Action="Copy"... > tag in a loop. So that all those files
returned by the query could copy to a users specified drive. Please look at my code for
<cffile Action="Copy"... > and both cases I am getting error such as

Unable to copy file 'http:\\www.nickmcdonald.com\share\files\this.doc' to
path 'c:\nick\web folder\'. Error: Access is denied. (error 5).

Although the Security setting for cffile is enabled. ****** Do I need to look in the web server setting too
for this tag.

Please tell me if the above approach to save all the files is a good idea if not what else I can do except
this one ----------> ***I learned that I could used cfexecute tag to zip all the files and then copy that zip file
using cffile tag and place it into user specific drive or folder. *** Please tell me if this is correct approach
how I code this?

Well here is what I coded so far:

__________________________________________________________

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>My Query</title>
<p STYLE="page-break-before: always"> To Have A Nice Break</p>

</head>
<body onload="Javascript:window.print();" text="#000080" link="#0000FF" vlink="#800080" alink="#808000">

<--- SQL Query that returns different files -->

<cfquery name="myQuery" datasource="BigDatabase">
SELECT Name, GetPath
FROM File_Table, Primary_ID_Table
WHERE File_Table.Date = 'December 2002'
AND File_Table.ID= Primary_ID_Table.ID
</cfquery>

<-- Currently I am storing the query result in the following table -->
<-- This could change depends what is more convenient. In -->
<-- other words may be a list box or is it better to store in -->
<-- An array? All these files need to be save at once in a folder or hard drive-->
<-- as user click on the save push button.
<-- Also need to print all these file to the -->
<-- user specified printer at once, once user lick on the print button-->

<cftable query="myQuery">
<cfcol header="Name"
text=#Name#>
<cfcol header="GetPath"
text=#LinkPath#>
</cftable>

<cfloop query="myQuery">

<cfset webPath="http://www.nickmcdonald.com/share/files/">
<cfset correctPath = '#insert(Name, webPath, Len(webPath))#'>

<-- This part of the code do not work give me access violations error. Also not sure if this way I can
<-- save all the files at once. In this case users probably do not need to click on the save button.

<cffile action="copy"
SOURCE=correctPath>
DESTINATION="c:\nick\web folder\">

<-- Since above <cffile action="copy" ... did not work I try the following code
<-- and still getting error.

<cffile action="copy"
SOURCE="http:\\www.nickmcdonald.com\share\files\this.doc"
DESTINATION="c:\nick\web folder\">

</cfloop>

<--- The following code print the content of the whole path name and file name -->

<cftable query="myQuery">
<cfcol header="Absolute Path"
align="left"
width="80"
text=#CorrectPath#>
<cfcol header="Name"
align="Left"
text=#Name#>
</cftable>


<-- The following buttons could be implement different way, depend what kind solution one of you could provide me.

<cfform>
<input type="button" value="Save All" ONCLICK=(" I am sure I need to call some kind of script or something here
that would give user choice to save all the files returned by the SQL to the users specific drive")>

<input type="button" VALUE="Print All" ONCLICK=("Another Script or something here that would give user choice
to print the query result to the users specific desigated printer")>

</cfform>

</body>
</html>

__________________________________________________________

PLEASE tell me how I save all the files at once into a specific folder or drive.

The approach I took is it the best way or there is a better method?

Is it possible using JavaScript? If so then please tell me what is the code to save all the files at once.

If not what else I can do to save all the files at once and Print all the files in the user specified printer.

PLEASE HELP ME.