Fileuploader with Iframe

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Mar 2009
Posts: 51
Reputation: Dhaneshnm is an unknown quantity at this point 
Solved Threads: 6
Dhaneshnm's Avatar
Dhaneshnm Dhaneshnm is offline Offline
Junior Poster in Training

Fileuploader with Iframe

 
0
  #1
Oct 13th, 2009
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:

  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>
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 6
Reputation: shenulal is an unknown quantity at this point 
Solved Threads: 2
shenulal shenulal is offline Offline
Newbie Poster
 
0
  #2
Oct 13th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 51
Reputation: Dhaneshnm is an unknown quantity at this point 
Solved Threads: 6
Dhaneshnm's Avatar
Dhaneshnm Dhaneshnm is offline Offline
Junior Poster in Training
 
0
  #3
Oct 13th, 2009
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...
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 254
Reputation: samarudge is an unknown quantity at this point 
Solved Threads: 20
samarudge samarudge is offline Offline
Posting Whiz in Training
 
1
  #4
Oct 14th, 2009
  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?
My Blog, Life and everything that matters to me - SamRudge.co.uk

2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 51
Reputation: Dhaneshnm is an unknown quantity at this point 
Solved Threads: 6
Dhaneshnm's Avatar
Dhaneshnm Dhaneshnm is offline Offline
Junior Poster in Training
 
0
  #5
Oct 14th, 2009
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?
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 254
Reputation: samarudge is an unknown quantity at this point 
Solved Threads: 20
samarudge samarudge is offline Offline
Posting Whiz in Training
 
0
  #6
Oct 14th, 2009
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
My Blog, Life and everything that matters to me - SamRudge.co.uk

2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 51
Reputation: Dhaneshnm is an unknown quantity at this point 
Solved Threads: 6
Dhaneshnm's Avatar
Dhaneshnm Dhaneshnm is offline Offline
Junior Poster in Training
 
0
  #7
Oct 14th, 2009
Ok.
Reply With Quote Quick reply to this message  
Reply

Tags
asp.net, fileuploader, iframe

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ASP.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC