ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 17th, 2012, 01:33 PM
bsmith863 bsmith863 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2009
Posts: 38 bsmith863 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 11 h 49 m 42 sec
Reputation Power: 4
Error Generating Excel file with ColdFusion7

I am trying to generate an Excel file using CF MX7 and it seems to work fine when I test on my own machine (which acts as my testing server) but generates an error on the production server: Unable to create temporary file
Below is the code:
Code:
<cfsavecontent variable="strExcelData">
 
	<style type="text/css">
		table tr td{font-family:"Times New Roman", Times, serif; padding:0 1em 1em 1em; text-align:center;}
		.blankCell{background-color:#6E8;}
		.columnHeader{background-color:#6E8; text-align:center; font-weight:bold;}
		.commentsColumn{background-color:#6E8; width:200px; text-align:center; font-weight:bold;}
	</style>

	....Various cfqueries here...
	
	<!--- Bunch of cfparam Definitions Here --->
	<cfparam name="Var.myVar1" default="">
	<cfparam name="Var.myVar2" default="">
	....<More cfparam definitions>....
	
	<table>
		<tr><td colspan="4">Patient Flowsheet</td></tr>
		
		<cfoutput>
			<tr>
				.....................................
				....Dataset From Queries goes here...
				.....................................
			</tr>
		</cfoutput>
	</table>
</cfsavecontent>

<cfheader name="Content-Disposition" value="filename=Patient_Flowsheet.xls" />
 
<!--- Get the temp file for streaming. --->
<cfset strFilePath = GetTempFile(GetTempDirectory(), "excel_") />

<!--- Write the excel data to the file. --->
<cffile action="WRITE" file="#strFilePath#" output="#strExcelData.Trim()#" />

<cfcontent type="application/msexcel" variable="#ToBinary( ToBase64( strExcelData.Trim() ) )#" />


Could there be settings on the production server (that I do not have access to) that could explain why it works on the local machine but not on the remote one? If yes, what is the workaround?

Reply With Quote
  #2  
Old February 17th, 2012, 02:29 PM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
Looks like the server does not allow you to write to temp directory?

Reply With Quote
  #3  
Old February 20th, 2012, 09:37 AM
bsmith863 bsmith863 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2009
Posts: 38 bsmith863 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 11 h 49 m 42 sec
Reputation Power: 4
Quote:
Originally Posted by kiteless
Looks like the server does not allow you to write to temp directory?

So is there another way to do this?

Reply With Quote
  #4  
Old February 20th, 2012, 12:37 PM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
You could try writing to some other directory (perhaps one within your own directory structure). But if the host has disabled writing to the file system completely, then your only options are to switch hosts or attempt to create the content and push it with cfcontent without saving it to disk.

Looking at your code, you could try just removing the GetTempFile() and cffile lines, since you're pushing the content straight into cfcontent as a variable.

Reply With Quote
  #5  
Old February 20th, 2012, 01:14 PM
bsmith863 bsmith863 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2009
Posts: 38 bsmith863 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 11 h 49 m 42 sec
Reputation Power: 4
Quote:
Originally Posted by kiteless
You could try writing to some other directory (perhaps one within your own directory structure). But if the host has disabled writing to the file system completely, then your only options are to switch hosts or attempt to create the content and push it with cfcontent without saving it to disk.

Looking at your code, you could try just removing the GetTempFile() and cffile lines, since you're pushing the content straight into cfcontent as a variable.


Awesome! That worked beautifully.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Error Generating Excel file with ColdFusion7

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap