473,511 Members | 14,951 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File Upload using AJAX

11 New Member
Hi friends,

I want to upload a file on AJAX web page. The HTML code i m using is:

----------------------------------------------------------------------------------------
[HTML]<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" OnClick="Button1_Click" Text="Button" />
</ContentTemplate>
</asp:UpdatePanel>
[/HTML]-----------------------------------------------------------------------------------------
The problem is that when i run the program the page gets Auto postback and the value in the fileUpload gets cleared. and the error of "object reference cannot be set to null" comes on the below line.....
string st=FileUpload1.PostedFile.FileName;

I tried using viewstate but still the problem is of Autopostback......
No effect with triggers and update mode set to conditional....Please help me out.
Aug 3 '07 #1
1 1542
acoder
16,027 Recognized Expert Moderator MVP
See this thread and this one. An Ajax file upload is not really possible in the normal way. Use an iframe to make it seem as if it's uploaded on the same page without refreshing.
Sep 12 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

12
7745
by: JMB | last post by:
Hello, I was wondering if anyone knew of any projects extending the inline upload progress bar to utilize an inpage image uploader with bar, without having to refresh or go to a seperate page,...
6
10084
by: Marko Vuksanovic | last post by:
I am trying to implement a file upload progress indicator (doesn't have to be a progress bar) using atlas... I do realize that the indicator cannot be implemented using Update panel control, but is...
3
3891
by: dreamznatcher | last post by:
Hello, I found a script here: http://www.webtoolkit.info/ajax-file-upload.html which supposedly allows you to upload files using AJAX (I'm not an expert). The site claims it's the best way to...
3
4481
by: kksandeep | last post by:
i am using this three files to uplod file. i got this file from net but i think these have some error. i am new to this field plz help the script i found is some helpful but not too that i need ...
11
8376
by: kj | last post by:
I would like to convert a form that currently uses the traditional CGI sequence (i.e. the action associated with the form sends a POST request to a server-side CGI script) to one that uses AJAX to...
0
7237
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
7137
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...
0
7349
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7417
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7506
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4734
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3210
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.