473,385 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Two Questions

1. I have three Upload controls on my form. When someone clicks a
checkbox, the upload control becomes visible and the user can click the
upload button and the file uploads great. However, if someone clicks on the
second or thrid checkbox to upload a file and makes these corresponding
controls visible to upload files, the file I have selected in the first box
disappears. I have autopost back = true for the checkbox to fire off the
following event:

Dim intAttachment As Integer

Dim strTemp As String

If chkDescription.Checked = True And InStr(txtProblemDescription.Text, "See
Attachment for Details") = 0 Then

txtProblemDescription.Text &= " --See Attachment for Details"

uplDescription.Visible = True

lblDescriptionUpload.Visible = True

Else

intAttachment = InStr(txtProblemDescription.Text, "--See Attachment for
Details", CompareMethod.Text)

If intAttachment > 0 Then

strTemp = Mid(txtProblemDescription.Text, 1, intAttachment - 1)

txtProblemDescription.Text = strTemp

End If

uplDescription.Visible = False

lblDescriptionUpload.Visible = False

End If

uplDescription if the name of the upload control. I need to retain the file
the user selected between post backs. How do I do this?

2. When someone selects a file for upload some files I get the following
error:

Maximum request length exceeded.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Maximum request length
exceeded.

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): Maximum request length exceeded.]
System.Web.HttpRequest.GetEntireRawContent() +895
System.Web.HttpRequest.GetMultipartContent()
System.Web.HttpRequest.FillInFormCollection() +257
System.Web.HttpRequest.get_Form() +50
System.Web.UI.Page.GetCollectionBasedOnMethod()
System.Web.UI.Page.DeterminePostBackMode()
System.Web.UI.Page.ProcessRequestMain()

--------------------------------------------------------------------------------

Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET
Version:1.1.4322.2032

How do I get past this error? What is the max file size. The file size I
am trying to upload is about 4 meg. Any suggestions would be very much
apprecated.

john


Nov 19 '05 #1
4 1090
I don't think you can do this. You cannot programatically set the value
of the file name in a file upload control, for security reasons.

You may want to consider unhiding the file upload controls on the
client side, using javascript.

Check out the way gmail does it.

Cheers

Nov 19 '05 #2
Agree; client-side is the way to go here to hide/unhide the controls.

<ne**********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I don't think you can do this. You cannot programatically set the value
of the file name in a file upload control, for security reasons.

You may want to consider unhiding the file upload controls on the
client side, using javascript.

Check out the way gmail does it.

Cheers

Nov 19 '05 #3
How would I hide these controls with client side javascript. I know how to
add the javascript code with the attributes function, but what code would I
use to hide and show the controls?

John
"john wright" <ri**********@hotmail.com> wrote in message
news:Oe**************@tk2msftngp13.phx.gbl...
1. I have three Upload controls on my form. When someone clicks a
checkbox, the upload control becomes visible and the user can click the
upload button and the file uploads great. However, if someone clicks on
the second or thrid checkbox to upload a file and makes these
corresponding controls visible to upload files, the file I have selected
in the first box disappears. I have autopost back = true for the checkbox
to fire off the following event:

Dim intAttachment As Integer

Dim strTemp As String

If chkDescription.Checked = True And InStr(txtProblemDescription.Text,
"See Attachment for Details") = 0 Then

txtProblemDescription.Text &= " --See Attachment for Details"

uplDescription.Visible = True

lblDescriptionUpload.Visible = True

Else

intAttachment = InStr(txtProblemDescription.Text, "--See Attachment for
Details", CompareMethod.Text)

If intAttachment > 0 Then

strTemp = Mid(txtProblemDescription.Text, 1, intAttachment - 1)

txtProblemDescription.Text = strTemp

End If

uplDescription.Visible = False

lblDescriptionUpload.Visible = False

End If

uplDescription if the name of the upload control. I need to retain the
file the user selected between post backs. How do I do this?

2. When someone selects a file for upload some files I get the following
error:

Maximum request length exceeded.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Maximum request length
exceeded.

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): Maximum request length exceeded.]
System.Web.HttpRequest.GetEntireRawContent() +895
System.Web.HttpRequest.GetMultipartContent()
System.Web.HttpRequest.FillInFormCollection() +257
System.Web.HttpRequest.get_Form() +50
System.Web.UI.Page.GetCollectionBasedOnMethod()
System.Web.UI.Page.DeterminePostBackMode()
System.Web.UI.Page.ProcessRequestMain()

--------------------------------------------------------------------------------

Version Information: Microsoft .NET Framework Version:1.1.4322.2032;
ASP.NET Version:1.1.4322.2032

How do I get past this error? What is the max file size. The file size I
am trying to upload is about 4 meg. Any suggestions would be very much
apprecated.

john

Nov 19 '05 #4
this is a very simple example on how to do it:

<html>
<head>

<script type="text/javascript">

function displayElement(element)
{
element.style.display = "block";
}

function getElement(id)
{
return document.getElementById(id);
}

</script>

</head>
<body>
<form runat="server">
<a href="#" onclick="displayElement(getElement('file1'));
return false;">Upload a file</a>
<br />
<input id="file1" style="DISPLAY: none" type="file" />
</form>
</body>
</html>

You could either have several hidden file fields, and display them when
you need to, or create them on the fly.

Nov 19 '05 #5

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

Similar topics

0
by: softwareengineer2006 | last post by:
All Interview Questions And Answers 10000 Interview Questions And Answers(C,C++,JAVA,DOTNET,Oracle,SAP) I have listed over 10000 interview questions asked in interview/placement test papers for...
0
by: softwareengineer2006 | last post by:
All Interview Questions And Answers 10000 Interview Questions And Answers(C,C++,JAVA,DOTNET,Oracle,SAP) I have listed over 10000 interview questions asked in interview/placement test papers for...
0
by: softwareengineer2006 | last post by:
All Interview Questions And Answers 10000 Interview Questions And Answers(C,C++,JAVA,DOTNET,Oracle,SAP) I have listed over 10000 interview questions asked in interview/placement test papers for...
0
by: connectrajesh | last post by:
INTERVIEWINFO.NET http://www.interviewinfo.net FREE WEB SITE AND SERVICE FOR JOB SEEKERS /FRESH GRADUATES NO ADVERTISEMENT
0
by: connectrajesh | last post by:
INTERVIEWINFO.NET http://www.interviewinfo.net FREE WEB SITE AND SERVICE FOR JOB SEEKERS /FRESH GRADUATES NO ADVERTISEMENT VIEW Interview questions and interview experiences , articles...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.