ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
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 October 10th, 2005, 10:52 AM
cootjealweer1 cootjealweer1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 28 cootjealweer1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 38 m 59 sec
Reputation Power: 0
Huge file upload with coldfusion to win2003 server

Hi all,

I want to upload huge files to a win 2003 server making use of the cffile upload, the uploading goes very well only with big files it goes wrong.

Now i heard about a setting for asp upload in win2003 server that you could update like you want, is there such a setting for coldfusion in win2003 server to, or somewhere in the coldfusion admin?

This is my code:

-----------------------------------------------------------
<cfif isDefined("form.file") AND form.file NEQ "">
<cfif cgi.content_length EQ "">
<cfscript>
WriteOutPut("Your browser reported a badly-formed HTTP header. This could be caused by an error, a bug in your browser or the settings on your proxy/firewall");
</cfscript>
<cfabort>
</cfif>
<cfset tmtMaxSizeKB="5000000">
<cfset tmtMaxSize="#Evaluate(tmtMaxSizeKB*1024)#">
<!--- Check for file size as reported by the HTTP header--->
<cfif Val(cgi.content_length) GT tmtMaxSize>
<cfscript>
WriteOutPut("The selected file's size is greater than " & #tmtMaxSizeKB# & " kilobytes which is the maximum size allowed, please select another one and try again.");
</cfscript>
<cfabort>
</cfif>
<cftry>
<cffile action="upload" filefield="file" destination="#ExpandPath("/spiriloged/pages/upload")#" nameconflict="MakeUnique">

<!--- If the file upload failed --->
<cfcatch type="Any">
<cfscript>
WriteOutPut("An error occurred during the file upload process.<br><br>");
WriteOutPut("This is likely due to one of the reasons below:<br><br>");
WriteOutPut("1) The MIME type of the uploaded file was not accepted by the server. Please verify that you are uploading a file of the appropriate type.<br>");
WriteOutPut("2) A file with the same name already exist on the server.<br>");
WriteOutPut("3) The application doesn't have the correct permissions on the server.<br><br>");
WriteOutPut("If the problem persist, please contact the website's administrator.");
</cfscript>
<cfabort>
</cfcatch>
</cftry>
<cfif isDefined("file.FileWasSaved")><!--- To be sure, check the file size again, just in case the HTTP header was faked --->
<cfif file.FileSize GT tmtMaxSize>
<cfset tmtServerFilePath=file.ServerDirectory&"\"&file.ServerFile>
<cfif FileExists(tmtServerFilePath)>
<cftry>
<!--- Delete the beast --->
<cffile action="delete" file="#tmtServerFilePath#">
<cfscript>
WriteOutPut("The uploaded file's size is greater than " & #tmtMaxSizeKB# & " kilobytes which is the maximum size allowed, please select another one and try again.");
</cfscript>
<cfabort>
<cfcatch type="Any">
<!--- Something went wrong on deleting, display error --->
<cfscript>
WriteOutPut("An error occurred during the file upload process");
</cfscript>
<cfabort>
</cfcatch>
</cftry>
</cfif>
</cfif>
<!--- Store the name of the file inside the form variable --->
<cfset form.file=file.ServerFile>
<!--- Redirect if needed --->
<cfset tmt_upload_redirect="">
<cfif tmt_upload_redirect NEQ "">
<cflocation url="#tmt_upload_redirect#">
</cfif>
<!--- If the file was not saved, disply error then abort --->
<cfelse>
<cfscript>
WriteOutPut("An error occurred during the file upload process");
</cfscript>
<cfabort>
</cfif>
</cfif>
-----------------------------------------------------------

i get a cant display page with
this error:

cant find the server or dns error
Internet Explorer

Reply With Quote
  #2  
Old October 10th, 2005, 11:27 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,689 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 16 h 33 m 51 sec
Reputation Power: 53
With any J2EE server you are limited by the amount of allocated JVM memory. So if you want you can look into modifying the JVM memory arguments which you will find in the CFMX administrator (or the JRun administrator if you are using the multiserver configuration). However, if you are uploading files that big I would strongly urge another approach. FTP would probably end up being much more applicable and you would run into no issues with size. Further, you won't be tying up a CF thread for minutes or hours if you do this outside of CF. If multiple people try to upload large files to your CF app you're going to greatly lower the performance of the entire CF engine.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old October 10th, 2005, 01:14 PM
cootjealweer1 cootjealweer1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 28 cootjealweer1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 38 m 59 sec
Reputation Power: 0
Thanks for your info, it's a shame this can't work because i've made a application that would users allow to upload a file with description and photo enz, after the upload a cfmmail would be send to notifie there was a new upload....

Is there a way to do this with ftp (like you said) but then i a sort of nice form layout way so that users can edit al sort of info and that after that ftp upload a cfmmail can be send?

And is there a way to auto zip a upload file, also with the ftp version?

Thanks in advance

Reply With Quote
  #4  
Old October 10th, 2005, 06:00 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,689 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 16 h 33 m 51 sec
Reputation Power: 53
You can certainly use CF to upload files, I just strongly recommend not uploading 500 meg files.

If you have no choice but to let users move something like 1 gigabyte files then yes I would introduce them to an FTP client and have them upload that way. Once the file is FTPed to the server you can let users add comments or anything else you want using a web interface.

Reply With Quote
  #5  
Old October 11th, 2005, 06:38 AM
cootjealweer1 cootjealweer1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 28 cootjealweer1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 38 m 59 sec
Reputation Power: 0
Ok thanks again, i gonna think of something like you said

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Huge file upload with coldfusion to win2003 server


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT