472,378 Members | 1,236 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,378 software developers and data experts.

File Upload (Email) and catching the Upload size of 4mb

I am confussed on what the heck is going on ?! I have an HTML INPUT
File Box on an Email Piece of an application. I know that File Size is
set to 4MB in the WebConfig File and that is fine, but I have a couple
problems that include the magical 4mb number.

1. My problem is that when my file is over the 4 mb limit. If the 4 MB
limit is met then the code on the button I use doesn't even fire (as I
have code to check the file length before it is attached to the email
maessage). How or what can be done to capture the error/file size?

I do have code in my button to capture it, but it never runs,

Dim AttachmentLength As Integer = MyFile.PostedFile.ContentLength

If AttachmentLength < 4000000 Then
Response.Write("NOT too big")
Response.Write("TOO big")
End If

2. If my File is between 1.6/1.7MB and 4MB, it is okay until the part
where the email is built and sent. It errors out at:
"Catch ehttp As System.Web.HttpException"
and replies "***ERRORS OUT HERE !! ***".

Why between the 1.6mb and 4mb mark does it bomb out at the emailing
piece ?!

Msg.From = "BL**@BLAH.com"
Msg.To = "BL**@BLAH.com"
Msg.Subject = SubjectTextBox.Text
Msg.Body = MessageTextBox.Text
Msg.BodyFormat = MailFormat.Text
SmtpMail.SmtpServer = .....
"<script language='javascript'>alert(successful')</script>")
Catch ehttp As System.Web.HttpException
"<script language='javascript'>alert('***ERRORS OUT HERE !!
End Try
Catch ee As IndexOutOfRangeException
"<script language='javascript'>alert('UNKNOWN ERROR ***')
End Try

Jul 21 '05 #1
1 2122
This is a follow up to my previous message as I am having the same
inconsistant issues with the Attachment Size and what is set where

I have made sure all 4 settings are all the same (4 MB) either by
defualt or by Changing them.
- Web.Config
- Machine.Config
- Code Behind

- In IIS, I changed the default "Limit Message Size to (KB)" from 2048
to 4096.

- In the Web.Config, I have added:
"<httpRuntime maxRequestLength="4096"

- In Machine.Config I have verified that the settings are as follows
(by defualt):
"<httpRuntime executionTimeout="90"

- In Code Behind, I have the following code to "Weed out" and give an
error to the user per the file size:
"If AttachmentLength > 4000000 Then
Page.RegisterClientScriptBlock("Fill465", "<script
language='javascript'>alert('ERROR - File too Large.')</script>")
End If"

The problem is that Attachments that are est. 2992KB (2.9MB) are okay
and send. The Files that are 3065KB (3.0MB) or larger don't send nor
do anything error related/generate per the IF Statement in th Code
behind. Nothing !! No JAVAScript Error per Code Behind, No Error from
Server, NOTHING !! WTF ?!?!?!?!?!?!?!?!?!
Attachment = 2992kb = Okay/Sent Fine (Good !!)
Attachment = 3065kb = NOTHING HAPPENS (BAD !!)

Why in the world is this happening ?!?!

As a TEST left the IIS Settings the same , Web.Config and
Machine.Config all the same but changed the Code Behind to give the
JAVAScript Error if over 1 MB (>1000000) and the results are confusing
Here is what happened with some more attachments:
Attachment <= 929kb = Okay/Sent Fine (Good !!)
Attachment >= 1022kb and <=3065kb = JavaScript Error is generated
(Good !!)
Attachment >= 4259kb = NOTHING HAPPENS (BAD !!)
1. Does anyone have any type of explination or things I can try?
2. What order is the size checked (as someone mentioned that the
Web.Config over rides the Machine.Config File) ?
3. In the Machine.Config, the setting is set to 4096:
"maxRequestLength="4096"", but the explination says 3000kb: "
maxBatchGeneratedFileSize="max combined size (in KB) of the generated
source files per batched compilation" // Default: 3000KB"?
4. How can I tell the whole email size and not just the Attachement?

Thanks !!!
Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Dave Smithz | last post by:
Hi There, I have a PHP script that sends an email with attachment and works great when provided the path to the file to send. However this file needs to be on the same server as the script. ...
by: BTHOMASinOHIO | last post by:
I am confussed on what the heck is going on ?! I have an HTML INPUT File Box on an Email Piece of an application. I know that File Size is set to 4MB in the WebConfig File and that is fine, but I...
by: Jefferis NoSpamme | last post by:
Hi all, I'm trying to limit the file size of an image submission and I keep running into various problems. I've got most of it working, but I'm stumped and I have a basic question as to WHY this...
by: UJ | last post by:
I'm trying to limit the size of a file the user can upload. I want it so that if the file is larger than 100MB, I tell them it needs to be smaller. I put code in when they 'upload' the file to...
by: prasenjit2007 | last post by:
I have a main form for inputing the (to/from/mesg/file) with the following code:- <html> <body> <table> <tr> <td>To:</td> <td><input type="text" name="to" size="50" ...
by: chrisj | last post by:
I'm using freeASPupload and got some assistance integrating to a Member script. It works successfully. In this modified version there are two groups that use this upload script. Members of one...
by: cassbiz | last post by:
Could use some help here. This script is carrying over an image just fine but the text isn't coming over. can you see why it is not working???? from the form I want to carry over two lines of...
by: Lawrence Krubner | last post by:
To guard against our users possibly uploading huge files, I've got this in my php.ini file: ; Maximum size of POST data that PHP will accept. post_max_size = 10M On a server running Ubuntu...
by: owz2008 | last post by:
This has probably been covered before but could not find a similar thread. Basically I have created a form which can be viewed at www.icomworks.co.uk/canvaspayform.html I want to submit the...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
by: F22F35 | last post by:
I am a newbie to Access (most programming for that matter). I need help in creating an Access database that keeps the history of each user in a database. For example, a user might have lesson 1 sent...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.