Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 15th, 2008, 07:28 AM
Registered User
Join Date: Apr 2007
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Fileupload in Ajax

Hi to all,
              I want to upload a file i.e image after uploading to hosting server ,the image which uploaded must be visible on the right hand of the file upload control.I did it in normal asp.net page.When i try this whole thing in ajax it shows error.

              After all my research in internet,i concluded that updatepanel control is not supports file uploading process.

              What i have to do now.any valueable suggestion...

  #2 (permalink)  
Old October 17th, 2008, 10:24 AM
Friend of Wrox
Points: 1,935, Level: 17
Points: 1,935, Level: 17 Points: 1,935, Level: 17 Points: 1,935, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Aug 2004
Location: United Kingdom
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post

Can you post the exact error you getting, so that we can suggest a resolution accordingly.

  #3 (permalink)  
Old October 18th, 2008, 03:13 AM
Registered User
Join Date: Apr 2007
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks for your reply.

This is on my html side

    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
          <ContentTemplate >
           <asp:FileUpload ID="FileUpload1" runat="server" />
              <asp:Button ID="Button1" runat="server" Text="Upload"
            OnClick="Button1_Click" />


On coding side I write just one line

 Protected Sub Btnupload_Click(ByVal sender As Object, ByVal e As System.EventArgs)

        FileUpload1.PostedFile.SaveAs(Server.MapPath("./") & "uploadimg.jpg")

    End Sub

Error is :-
Object Reference Not Set to an instance of object.

I know this is very small error .We can over come this error by creating Instance to that object By using 'New' keyword.
At this time i'm feeling difficulty.

Help me.

  #4 (permalink)  
Old October 18th, 2008, 09:59 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts

Hi there,

This problem is due to the design of Ajax and the FileUpload control. It's not something that can be fixed with a New keyword; it's caused by the fact that no file was uploaded, so PostedFile is Nothing...

Search Google or your favorite search engine for "FileUpload ajax problem" for more background and work arounds.



Imar Spaanjaars
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
FileUpload control aliirfan84 ASP.NET 2.0 Professional 1 June 2nd, 2007 03:37 PM
Recommend an AJAX IDE - JoyiStar AJAX WebShop. kingstar Ajax 4 December 15th, 2006 05:12 AM
FileUpload Control MunishBhatia ASP.NET 2.0 Basics 2 December 6th, 2006 04:03 AM
FileUpload FIlter tony_j_hug ASP.NET 2.0 Basics 1 October 28th, 2005 06:55 PM

All times are GMT -4. The time now is 10:46 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.