|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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. |
|
#5
|
|||
|
|||
|
Ok thanks again, i gonna think of something like you said
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Huge file upload with coldfusion to win2003 server |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|