944,179 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Marked Solved
  • Views: 2424
  • ASP.NET RSS
Oct 13th, 2009
0

Fileuploader with Iframe

Expand Post »
I want a file uploader,that doesnt cause post back in asp.net 2.0.
With some googleing i found that if i set traget of the form to an iframe on the same page,i can avoid post back.But when i try this the page is getting opened in new window.(ie7 is the browser i am using).

I understand that post back will happen anyway,but can we avoid the page getting opened in new window some how?

Please find my code below:

ASP.NET Syntax (Toggle Plain Text)
  1. <form id="form1" action="#" method="post" enctype="multipart/form-data" runat="server" target="myframe">
  2. <input type="file" id="myfile" accept="image" runat="server"/>
  3. <input type="submit" value="upload" runat="server" />
  4. </form>
  5. <iframe id="myframe">
  6. </iframe>
Similar Threads
Reputation Points: 22
Solved Threads: 7
Junior Poster in Training
Dhaneshnm is offline Offline
52 posts
since Mar 2009
Oct 13th, 2009
0
Re: Fileuploader with Iframe
Hai,
Why you want to avoid the Postback? Is it to retain the upload path?
If its for retaining path you put one hidden control in the form and set the path to the hidden control so that you can use it again after postback.
If you really want to avoid the postback effect you can use Ajax update panel to prevent the page postback.
Hope this will help you.

thanks,
Shenu
Reputation Points: 10
Solved Threads: 2
Newbie Poster
shenulal is offline Offline
6 posts
since Oct 2009
Oct 13th, 2009
0
Re: Fileuploader with Iframe
Quote ...
Hai,
Why you want to avoid the Postback? Is it to retain the upload path?
If its for retaining path you put one hidden control in the form and set the path to the hidden control so that you can use it again after postback.
If you really want to avoid the postback effect you can use Ajax update panel to prevent the page postback.
Hope this will help you.

thanks,
Shenu

File upload control doesnt seem to work in an update panel.And what i want is an ajax like uploader,where file uploading doesnt disturb other controls of the page.I can use a Modal pop up,but that will be a new page,exclusively for upload right?

i want not just the path,but the whole content of the file send to the server,on click of submit.And that should not disturb anything outside the form...
Reputation Points: 22
Solved Threads: 7
Junior Poster in Training
Dhaneshnm is offline Offline
52 posts
since Mar 2009
Oct 14th, 2009
1
Re: Fileuploader with Iframe
html Syntax (Toggle Plain Text)
  1. <form id="form1" action="#" method="post" enctype="multipart/form-data" runat="server" target="myframe">
  2. <input type="file" id="myfile" accept="image" runat="server"/>
  3. <input type="submit" value="upload" runat="server" />
  4. </form>
  5. <iframe id="myframe" name="myframe">
  6. </iframe>

Does that work now?
Reputation Points: 26
Solved Threads: 31
Posting Whiz
samarudge is offline Offline
354 posts
since May 2008
Oct 14th, 2009
0
Re: Fileuploader with Iframe
Kool.Its working fine now..Thanks a lot.
Can you explain why it was not working?
Whats the problem if use id instead of name?it wont recognise the iframe?
Reputation Points: 22
Solved Threads: 7
Junior Poster in Training
Dhaneshnm is offline Offline
52 posts
since Mar 2009
Oct 14th, 2009
0
Re: Fileuploader with Iframe
Firefox, Netscape Navigator and Opera will allow target to eather be an id= or a name= whereas IE only allows name= so I have both to cover all browsers
Reputation Points: 26
Solved Threads: 31
Posting Whiz
samarudge is offline Offline
354 posts
since May 2008
Oct 14th, 2009
0
Re: Fileuploader with Iframe
Ok.
Reputation Points: 22
Solved Threads: 7
Junior Poster in Training
Dhaneshnm is offline Offline
52 posts
since Mar 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Error uploading file - Could not find a part of the path
Next Thread in ASP.NET Forum Timeline: dash commerce starter kit...anyone?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC