Connecting Tech Pros Worldwide Forums | Help | Site Map

Help- File upload using ajax

vikysaran's Avatar
Newbie
 
Join Date: Nov 2006
Posts: 14
#1: Nov 10 '08
Hi,
Please check the attachment http://www.golsinc.com/app7/AJAXEnabledWebSite.zip
Here i made a small application for file upload. Made a huge form and need image upload without page refresh here.

i tried a lot, searched over net but finally my page is posting back on button click. If i dont use

<Triggers>
<asp:PostBackTrigger ControlID="Button1" />
</Triggers>

then it shows error in alert box "Object reference is not set to...."


please check the application and revert me ASAP....

Thanks in Advance....

Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,664
#2: Nov 10 '08

re: Help- File upload using ajax


if your problem comes from asp (at least that's what it seems to me) you should ask a moderator to move this thread to the asp forum.

regards
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#3: Nov 10 '08

re: Help- File upload using ajax


It would probably be ASP.NET.

If you want to upload a file without unloading the page, you can't use the XMLHttp request object because of the binary data. For a file upload, use a hidden iframe. See an example.
rnd me's Avatar
Expert
 
Join Date: Jun 2007
Location: Urbana IL
Posts: 411
#4: Nov 10 '08

re: Help- File upload using ajax


Quote:

Originally Posted by acoder

If you want to upload a file without unloading the page, you can't use the XMLHttp request object because of the binary data.

FF3 can do this for binary and text files. other browsers would be limited to doing this for text-based files only.
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#5: Nov 11 '08

re: Help- File upload using ajax


You could, but not in a normal internet environment. You'd need permissions and to change a setting in about:config, or have you got something else up your sleeve? :)
rnd me's Avatar
Expert
 
Join Date: Jun 2007
Location: Urbana IL
Posts: 411
#6: Nov 11 '08

re: Help- File upload using ajax


Quote:

Originally Posted by acoder

You could, but not in a normal internet environment. You'd need permissions and to change a setting in about:config, or have you got something else up your sleeve? :)

no, ive given up on recommending that (too much follow up).
i refer to something else, something better.

i am talking about sendAsBinary .

you can grab the file content from a "browsed" file input: ex
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('myFile').files.item(0).getAsBinary();
  2.  
check out the firefox3 file input interface
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#7: Nov 11 '08

re: Help- File upload using ajax


Interesting. Thanks. I'll have a play with this. Should be quite useful once other browsers follow suit.
Reply