Help- File upload using ajax

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vikysaran
    New Member
    • Nov 2006
    • 14

    Help- File upload using ajax

    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:PostBackTr igger ControlID="Butt on1" />
    </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
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    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

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      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.

      Comment

      • rnd me
        Recognized Expert Contributor
        • Jun 2007
        • 427

        #4
        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.

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          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? :)

          Comment

          • rnd me
            Recognized Expert Contributor
            • Jun 2007
            • 427

            #6
            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
            Code:
            document.getElementById('myFile').files.item(0).getAsBinary();
            check out the firefox3 file input interface

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

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

              Comment

              Working...