472,982 Members | 2,185 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,982 software developers and data experts.

multipart/form-data problem

Hello,

I have a really weird problem I've been trying to solve it without any luck
for the last couple of hours :(
I'm writing a "conference board" application (quite similar to ASP.NET
forum).
I don't use server controls in it (apart from Page).

The problem occurs on the page where visitor can post a new messages.
Basically, it's a form with couple of
edit controls, hidden fields, buttons and and a file upload control. Form
enctype is multipart/form-data (to enable file uploads)
The first 5 fields after <FORM> is hidden fields (Thats important!) When
user post that form I use Request.Params to extract required data.

The problem appeared after I added two checkbox controls at the end of the
form.

Now, if user types-in anything using multibyte encoding (i.e. in jewish,
arabic, ... or just special characters) and posts the form the 1st hidden
field
will go missing when I try to access it via Request.Params. Only 1st one -
all other fields will be just fine.

If I remove enctype="multipart/form-data" it will work fine. If I remove
last checkboxes it will work fine.
If I'll just use English it will work fine.

I understand it's very lengthy explanation and probably a bit confusing, but
I really stuck on this one.

I would appreciate any help and will be happy provide addiitonal information
if required.

Thanks in advance.

Alex


Nov 18 '05 #1
4 4516
Is there a reason you are using Request.Param instead of the asp.net method
of using web or html controls? You should try it and see if it'll fix your
problem.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Alex Sibilev" <NO********@sql.ru> wrote in message
news:Oh**************@TK2MSFTNGP12.phx.gbl...
Hello,

I have a really weird problem I've been trying to solve it without any luck for the last couple of hours :(
I'm writing a "conference board" application (quite similar to ASP.NET
forum).
I don't use server controls in it (apart from Page).

The problem occurs on the page where visitor can post a new messages.
Basically, it's a form with couple of
edit controls, hidden fields, buttons and and a file upload control. Form enctype is multipart/form-data (to enable file uploads)
The first 5 fields after <FORM> is hidden fields (Thats important!) When user post that form I use Request.Params to extract required data.

The problem appeared after I added two checkbox controls at the end of the form.

Now, if user types-in anything using multibyte encoding (i.e. in jewish,
arabic, ... or just special characters) and posts the form the 1st hidden
field
will go missing when I try to access it via Request.Params. Only 1st one - all other fields will be just fine.

If I remove enctype="multipart/form-data" it will work fine. If I remove
last checkboxes it will work fine.
If I'll just use English it will work fine.

I understand it's very lengthy explanation and probably a bit confusing, but I really stuck on this one.

I would appreciate any help and will be happy provide addiitonal information if required.

Thanks in advance.

Alex

Nov 18 '05 #2
Thanks for reply Karl,

I have my own html template processor and trying to squeeze from ASP.NET
everything I can, performance wise.
So I turned off Viewstate, AutoEventWireUp and using basic Request.Params &
Forms to get posted data.

Also I noticed more weird behaviour today. In my HTML I've got fields in
this order:
<form>
hidden fields
entry fields (text, textarea, radio)
submit buttons
checkboxes
</form>

Now, if I swap submit buttons with checkboxes it all starts to work. It
really driving me nuts.

Alex

"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:eW**************@TK2MSFTNGP11.phx.gbl...
Is there a reason you are using Request.Param instead of the asp.net
method
of using web or html controls? You should try it and see if it'll fix
your
problem.

Karl

Nov 18 '05 #3
I suppose in the meanwhile you solved the problem already, but since
I've been experiencing the same problem I'm going to post something
here anyway ;) (it may be useful still). The trouble here is this:

When you change the enctype to "multipart/form-data", you change the
way the form is sent, and apparantly it doesn't support the
checkboxes. The "multipart/form-data"-enctype neglects everything in
the code that is written under the submit-button. From there the
enctype automaticly changes back to the defauld
"application/x-www-form-urlencoded", so thats why the checkboxes will
work properly when situated under the submit.

Since locating the checkboxes únder the submit-button looks stupid, I
didn't accept this as a solution. This is the way I díd solve it:
I created a form inside a form. I didn't really expect it to work, but
it accually did :D. This is how it works:
Instead of this:

<form enctype="multipart/form-data" action="asppage.asp"
method="post">

<input type="file" name="file">
<input type="checkbox" name="checkbox">

<input type="submit">
</form>

I wrote this:

<form enctype="multipart/form-data" action="asppage.asp"
method="post">

<input type="file" name="file">
<form>
<input type="checkbox" name="checkbox">

<input type="submit">
</form>
</form>

This worked for me. All data was send and I was able to use it the way
wanted it to. I'm not sure it will work for everyone else having this
problem, but else you could always try to use dropdowns-menues with
yes/no inside them. I suppose that'll work also but it'll look less
good :P.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 18 '05 #4
Hi Unit,

You have some basic misunderstandings here. I hope I can clear them up for
you.
When you change the enctype to "multipart/form-data", you change the
way the form is sent, and apparantly it doesn't support the
checkboxes. The "multipart/form-data"-enctype neglects everything in
the code that is written under the submit-button. From there the
enctype automaticly changes back to the defauld
"application/x-www-form-urlencoded", so thats why the checkboxes will
work properly when situated under the submit.
This is all incorrect. Remember that we're talking about an HTML document
here, as far as the form is concerned. An HTML form can have only ONE
encoding type. That is defined in the form tag. If the enctype attribute is
set to "multipart/form-data," the entire form is encoded in that way. It has
nothing to do with any submit button, or checkboxes, or anything else except
the "enctype" tag. Everything in the form is encoded in the same way. Note
that I said "everything in the form." You can have more than one form on a
page. When a form submits, it doesn't submit the page, but only the form
fields contained within that form. So, you might want to check whether or
not you have more than one form on the page, or if some of the form fields
are outside of the form.

Checkbox data is indeed sent with the rest of the form data. I don't know
why you can't seem to get the data from the CheckBox, as you didn't describe
the issue you're having.
Since locating the checkboxes únder the submit-button looks stupid, I
didn't accept this as a solution. This is the way I díd solve it:
I created a form inside a form. I didn't really expect it to work, but
it accually did :D. This is how it works:
Your solution may have worked on the browser you tested it on, but it is not
right. You cannot nest forms in HTML. Well, as you have discovered, you CAN,
but it is a violation of the W3C standard to do so, and may produce
unexpected results depending upon the browser. In any case, it's a hack. And
it will bite you at some point.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"Unit" <m.****@chello-dot-nl.no-spam.invalid> wrote in message
news:41**********@Usenet.com... I suppose in the meanwhile you solved the problem already, but since
I've been experiencing the same problem I'm going to post something
here anyway ;) (it may be useful still). The trouble here is this:

When you change the enctype to "multipart/form-data", you change the
way the form is sent, and apparantly it doesn't support the
checkboxes. The "multipart/form-data"-enctype neglects everything in
the code that is written under the submit-button. From there the
enctype automaticly changes back to the defauld
"application/x-www-form-urlencoded", so thats why the checkboxes will
work properly when situated under the submit.

Since locating the checkboxes únder the submit-button looks stupid, I
didn't accept this as a solution. This is the way I díd solve it:
I created a form inside a form. I didn't really expect it to work, but
it accually did :D. This is how it works:
Instead of this:

<form enctype="multipart/form-data" action="asppage.asp"
method="post">

<input type="file" name="file">
<input type="checkbox" name="checkbox">

<input type="submit">
</form>

I wrote this:

<form enctype="multipart/form-data" action="asppage.asp"
method="post">

<input type="file" name="file">
<form>
<input type="checkbox" name="checkbox">

<input type="submit">
</form>
</form>

This worked for me. All data was send and I was able to use it the way
wanted it to. I'm not sure it will work for everyone else having this
problem, but else you could always try to use dropdowns-menues with
yes/no inside them. I suppose that'll work also but it'll look less
good :P.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*

Nov 18 '05 #5

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

Similar topics

2
by: Damien | last post by:
Hi to all, After hours of attempts and "googling", I'm still pulling my hair off my head when I try to send multipart html emails. It "works" on PCs with Outlook when I juste send a single...
5
by: lucanos | last post by:
Hey All, I'm having trouble trying to create a PHP file which will generate a multipart email message (containing both an HTML formatted part and a Plain Text formatted part). I have Googled...
4
by: Hunter Peress | last post by:
I have been unable to write a script that can do (and receieve) a multipart form upload. Also, it seems that there really are differences between python's implementation and else's. Can someone...
0
by: Travis Pupkin | last post by:
Hi, I have a form that triggers the sending of an e-mail via CDOSYS. I'd like to make this a nice HTML-formatted multipart message, but for some reason the text version is coming through blank....
3
by: c# newbie | last post by:
System.Web.Mail.MailFormat The enumerated values for MailFormat are: Html Text How can I send a multipart/alternative format message ?
4
by: John Fereira | last post by:
So, one of the limitations of multipart-form handling is that when an <input type="file" ..> tag is used it will bring up a window which allows a user to select a file for upload but won't allow...
0
by: Werner Maier | last post by:
Hi please can anybody help me to read a WEB side with Content-Type: multipart/x-mixed-replace ("Server Push") . I am a absolutly newbie with c# .net. i have problems to read the boundarys to...
3
by: Li Zhang | last post by:
I know I can use controlName.Value to retrieve the form fields value if I am in that page. But if I am out of the page, for example I am in a HttpModule, I want to retrieve a hidden filed value, Is...
2
by: Der tolle Emil | last post by:
Hi! I wrote a little function to send emails which works quite well. I already managed to send attachments correctly (also more than 1 per email) but I am not able to send a HTML mail containing...
4
by: yoram.ayalon | last post by:
Hi, I need to create a multipart request to UPS manifest upload electronic service. UPS wants the request to consist of a series of headers and bodies, and its not clear how can I use the...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.