• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Large CFFILE Uploads cause instant 404 error

New Here ,
Oct 01, 2006 Oct 01, 2006

Copy link to clipboard

Copied

I have the strangest issue. CFFILE uploads files up to about 2mb just fine but larger files cause a instantainious 404 error. The address bar still shows the URL of the form page, not the processing page. I have CFTRY implimented and it works - just not if I try to upload a huge file.

If I understand correctly, an uploaded file from a form is placed in memory first, before reaching the CFFILE command. If this is true, I see no way to pre test the size of a file before upload because it would still be placed in memory (and error).

This leaves me with trying to find an elegant way to display the insufficiant memory error insteaqd of the 404 page.

Any suggestions?

Scott

Processing script attached:
=========================================



TOPICS
Advanced techniques

Views

2.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 01, 2006 Oct 01, 2006

Copy link to clipboard

Copied

How about adding a <cftry> and check for the file size?

Something like this:

<!--- upload file --->
<cftry>
<cffile
action="upload"
accept="audio/mpeg,video/x-ms-wmv,video/mpeg,video/quicktime,video/avi,audio/midi"
filefield="UploadedFile"
destination="#LibraryDirectory#\"
nameconflict="overwrite">
<!--- Check for file size --->
<cfif CFFILE.FileSize GT 2097152>
<!--- Throw an error --->
<cfthrow
type="SizeError"
message="The file is too large. It cannot be more than 2MB.">
</cfif>
<!--- Catch the error --->
<cfcatch type="SizeError">
<!--- Show error message --->
<cfabort showerror="#CFCATCH.Message#">
</cfcatch>
</cftry>


--
Ken Ford
Adobe Community Expert


"senelson1" <webforumsuser@macromedia.com> wrote in message
news:efokmt$300$1@forums.macromedia.com...
>I have the strangest issue. CFFILE uploads files up to about 2mb just fine
>but
> larger files cause a instantainious 404 error. The address bar still shows
> the
> URL of the form page, not the processing page. I have CFTRY implimented
> and it
> works - just not if I try to upload a huge file.
>
> If I understand correctly, an uploaded file from a form is placed in
> memory
> first, before reaching the CFFILE command. If this is true, I see no way
> to pre
> test the size of a file before upload because it would still be placed in
> memory (and error).
>
> This leaves me with trying to find an elegant way to display the
> insufficiant
> memory error insteaqd of the 404 page.
>
> Any suggestions?
>
> Scott
>
> Processing script attached:
> =========================================
>
>
>
>
>
> <CFPARAM NAME="media_lib" DEFAULT="#FileRoot#\media">
> <!--- new name for the uploaded file? --->
> <CFSET NewServerFile = "#Form.ServerFile#">
>
> <cfset tmpFile = "#Trim(NewServerFile)#">
> <cfset tmpFile = "#LCase(tmpFile)#">
> <cfset tmpFile = "#ReplaceList(tmpFile," ","_")#">
> <CFTRY>
> <cfif (#UploadedFile# EQ "") OR (#NewServerFile# EQ "")>
> <br><br>
> <p align="center" class="Black_Headline">ERROR</p>
> <p align="center" class="bodybold">You need to specify a new name (can
> be
> the same but the field can not be blank) and a file to upload.</p>
> <p align="center" class="bodybold">Please use your browser's back button
> and
> try again.</p>
> <cfelse> <!--- #Form.UploadedFile# IS '' --->
>
> <!--- parameters --->
> <CFSET LibraryDirectory = "#media_lib#">
> <!--- upload file --->
> <CFFILE ACTION="UPLOAD"
>
> ACCEPT="audio/mpeg,video/x-ms-wmv,video/mpeg,video/quicktime,video/avi,audio/mid
> i"
> FILEFIELD="UploadedFile"
> DESTINATION="#LibraryDirectory#\"
> NAMECONFLICT="OVERWRITE">
>
> <!--- rename file --->
> <CFSET SourceName = LibraryDirectory & '\' & File.ServerFile>
> <CFSET DestinationName = LibraryDirectory & '\' & tmpFile>
> <CFIF "#SourceName#" NEQ "#DestinationName#">
> <CFFILE
> action="RENAME"
> source="#SourceName#"
> destination="#DestinationName#"
> >
> </CFIF>
>
> <cflocation url="p_admin_menu.cfm?mode=media_lib" addtoken="No">
>
> </cfif> <!--- #Form.UploadedFile# IS '' --->
>
> <CFCATCH TYPE="any">
> <cflocation url="p_mime_error.cfm?sfile=#UploadedFile#&tfile=#tmpFile#">
> </CFCATCH>
> </CFTRY>
>


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 02, 2006 Oct 02, 2006

Copy link to clipboard

Copied

After more testing I'm not sure this is even a CF issue. If I post to a blank template I still get the 404 error on large files. I can post to a non-processing page like the index.cfm and the URL changes to index.cfm but there's still the 404 error. If I refresh the index.cfm with the 404 error, the index page comes up fine. I've even tried posting to an existing HTML file and the same thing happens, so I'm baffeled and don't know where to look next. Could it be a Windows/IIS issue?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 02, 2006 Oct 02, 2006

Copy link to clipboard

Copied

I found the answer!

Article PS030924114
IIS Lockdown and URLScan upload size limit

Problem Description
A server running the Microsoft tools IIS Lockdown and URLScan rejects large uploads with a 404 Not Found error.
The new version 2.5 update of URLScan enforces a 30 MB limit on HTTP request size by default.

Solution
URLscan is usually located in the directory C:\Windows\system32\inetsrv\urlscan. Navigate to this directory and edit the urlscan.ini file. By default, this file has the entry:

MaxAllowedContentLength = 30000000

which restricts the maximum allowed upload size to 30 MB. Changing this entry to a larger value will allow the server to accept large uploads. You may need to restart IIS for changes to take effect after saving the file.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 20, 2012 Jun 20, 2012

Copy link to clipboard

Copied

LATEST

This has changed with IIS 7. Request filtering is built into the server. All websites default to 30MB upload limit. You can edit the requestLimits in the Configuration Editor for the specific site you want to change. This allows you to keep limits on the remainder of your sites.

Got to system.webServer/security/requestFiltering. Then open and edit maxAllowedContentLength.

http://www.windowsitpro.com/article/windows-gatekeeper-faqs/q-do-i-still-need-to-install-the-urlscan...

http://learn.iis.net/page.aspx/143/use-request-filtering/

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation