HTML Form inside ASP.NET form and fileupload

A

admlangford

Hi, I have an ASP.NET page which obviously uses a server side form.

I want a client to be able to add an HTML form to a page via a WYSIWYG
editor and this will be a basic HTML fileinput form with a submit
button.

The above renders fine but in my codebehind in the !Page.IsPostBack in
the Page_Load event I do the following

Response.Write(Request.Files.Count.ToString());

and the value is always 0, even when I upload an image via the basic
HTML fileinput form

Can anyone help me about what I am doing wrong here?

Thanks
Adam
 
M

Michael Nemtsev [MVP]

Hello (e-mail address removed),

does your client's added form have the runat="server" attribute?!
I'd recommend to test the actions on the standard page - take the source
of your generated page and try to do the same in asp.net page
and you will find the source of your problem easily

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
 
A

admlangford

Hi Michael, thanks for the suggestions.

In the end it was my own silly fault; I needed to add the following to
the form tag

enctype="multipart/form-data"

it worked perfectly after that

thanks again
Adam

Hello (e-mail address removed),

does your client's added form have the runat="server" attribute?!
I'd recommend to test the actions on the standard page - take the source
of your generated page and try to do the same in asp.net page
and you will find the source of your problem easily

---
WBR,
Michael  Nemtsev [.NET/C# MVP] :: blog:http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


want a client to be able to add an HTML form to a page via a WYSIWYG
editor and this will be a basic HTML fileinput form with a submit
button.
The above renders fine but in my codebehind in the !Page.IsPostBack in
the Page_Load event I do the following- Hide quoted text -

- Show quoted text -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top