This is a migrated thread and some comments may be shown as answers.

HttpPostedFile is null of the asp:FileUpload control

5 Answers 1076 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Geert
Top achievements
Rank 1
Geert asked on 09 Oct 2008, 02:59 PM
Hello,

thanks for the previous response , our first deadline is near.

We have one crucial issue still open:
According to this example it is possible to postback a button so an upload can be done.
http://demos.telerik.com/aspnet/prometheus/Ajax/Examples/Common/FileUpload/DefaultCS.aspx

The postback is triggered nicely but in the buttonevent it should do this:
HttpPostedFile postedFile=FileUpload1.PostedFile; With us the FileUpload1.PostedFile is null;, according to the object the upload control is empty but during the OnrequestStart Client event the file (filename) is in place.

Is there any idea hat could go wrong?

thanks in advance

The Sofim-team (Belgium)

5 Answers, 1 is accepted

Sort by
0
Geert
Top achievements
Rank 1
answered on 09 Oct 2008, 03:55 PM
Hello,

I want to make a little remark: The first time the start upload is pushed the uploadcontrol seems to have lost his file. If you put in the file again and push upload for the second time it works properly.

So why not the first time

Thanks in advance

The SOFIM-team (Belgium)
0
Geert
Top achievements
Rank 1
answered on 10 Oct 2008, 07:20 AM
Goodmorning,

I was still working on this issue yesterday and now its working BUT,...

I placed 

enctype

 

="multipart/form-data"

in the form tag and that solved the case (btw it is also in the example so the link above is correct). It is the first time as developer I use this property because I didn't know it existed, I have never had to use it. Is it possible to give a dummy explanation of this property because we cant figure it out.

thanks in advance

The Sofim-team (Belgium)

0
Veselin Vasilev
Telerik team
answered on 10 Oct 2008, 11:32 AM
Hi Geert,

The enctype="multipart/form-data" property is mandatory when you want to upload a file in your form. RadUpload and the standard FileUpload controls add this property automatically (invisible to the user), but the <input type="file"> control does not. That is why if you use only <input type="file"> controls - you need to add this property manually.

I am glad that you have found the solution.

Greetings,
Veselin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Geert
Top achievements
Rank 1
answered on 10 Oct 2008, 12:20 PM
Hello,

many thanks for the explanation.

Just glad we are going to be able to achieve ou first deadline and calmdown everyone.

read you soon.

The Sofim-team (Belgium)
0
vani
Top achievements
Rank 1
answered on 20 Mar 2009, 06:14 AM
i am using standard browse button in update panel, still if i add enctype="multipart/form-data" to my form tag then only everything is working fine. But you have explained that this property is required only when input browse button is used. I am using master page in my application.
Tags
Upload (Obsolete)
Asked by
Geert
Top achievements
Rank 1
Answers by
Geert
Top achievements
Rank 1
Veselin Vasilev
Telerik team
vani
Top achievements
Rank 1
Share this question
or