We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11413
    • 203 Posts
    Hi!

    I need to upload a picture to my server via AJAX. Is it possible, and if yes, how?

    thanks a lot in advance!

    Blaise
      Blaise Bernier

      www.medialdesign.com - Solutions for small business, hosting, design and more!
      • 15914
      • 145 Posts
      As far as I’m aware, you cannot send files to the server via POST using AJAX. It’s a security thing from Javascript. (I think.)
        Kunal Kapoor
        Technical Director
        Limesharp Internet Limited - Effective, Functional, Standards Compliant

        IRC Nick: KingKoopa
        Skype ID: KingKoopa16
        • 11413
        • 203 Posts
        Is there any way to bypass that even if it’s not using AJAX ??
          Blaise Bernier

          www.medialdesign.com - Solutions for small business, hosting, design and more!
          • 32241
          • 1,495 Posts
          Quote from: grunt_lord at Mar 15, 2006, 05:29 PM

          Is there any way to bypass that even if it’s not using AJAX ??

          check out PORK.iframe.
          http://beta.zapguide.nl/iframe/

          It’s the old traditional post system. What it does, it’s basically automatically generate iframe and stuff all your content in there and do posting. It will fetch the result from the server and return in the format of either JSON or plain text that can be stuffed into any container.

          WARNING: No documentation available.
            Wendy Novianto
            [font=Verdana]PT DJAMOER Technology Media
            [font=Verdana]Xituz Media
            • 11413
            • 203 Posts
            is there any example? It seems to do what I need, but I won’t trow myself into something like that without further info...
              Blaise Bernier

              www.medialdesign.com - Solutions for small business, hosting, design and more!
              • 32241
              • 1,495 Posts
              Quote from: grunt_lord at Mar 15, 2006, 06:27 PM

              is there any example? It seems to do what I need, but I won’t trow myself into something like that without further info...

              Just use it.
              View source the page, then you will understand how he use it.
              Basically you just need to put onsubmit event on your form to intercept the form submit.
              There are 2 way to receive the response, first is defining the update id container, and all the response from the corresponding posting will be put on this specific container id. Second, you can return the result in JSON format as an array. The array key will determined the element id, and the value of the array will be filled on that corresponding container id.
                Wendy Novianto
                [font=Verdana]PT DJAMOER Technology Media
                [font=Verdana]Xituz Media
                • 11413
                • 203 Posts
                thanks... I will try!
                  Blaise Bernier

                  www.medialdesign.com - Solutions for small business, hosting, design and more!
                  • 11413
                  • 203 Posts
                  yeah! easier than I thought... I’m gonna use that a lot then!
                    Blaise Bernier

                    www.medialdesign.com - Solutions for small business, hosting, design and more!
                    • 25663 MODX Staff
                    • 12,272 Posts
                    We then expect great examples and tutorials. wink
                      Ryan Thrash, MODX Co-Founder
                      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                      • 11413
                      • 203 Posts
                      After i’ve finished that module, I’ll do it!
                        Blaise Bernier

                        www.medialdesign.com - Solutions for small business, hosting, design and more!