File upload in ajax with PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • newlearner
    New Member
    • May 2007
    • 67

    File upload in ajax with PHP

    hi,
    im trying to upload a file using ajax and php. im not able to get the $FILES[fileName][tmp_name] and
    $FILES[fileName][name].

    But when i try it out in the traditional format its works good. but when i try it out in ajax im not able to get these values.

    I use POST method and the requestHeader's content type is set as multipart/form-data.

    Looking forward .....

    Thanks in advance for the reply
  • mrbadboy
    New Member
    • Jul 2007
    • 21

    #2
    do u using any other Content-type except multipart/form-data?

    Comment

    • newlearner
      New Member
      • May 2007
      • 67

      #3
      Originally posted by mrbadboy
      do u using any other Content-type except multipart/form-data?
      Yes i have used all others but in fail the thing is im not able to get the tmp_name value in the php file. but using the other content type i am able to get the file name but not the tmp_name of the file found inthe PC

      Looking forward...
      Thanks in advance for the reply.

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Heya, newlearner.

        Check the 'error' index of your file.



        For security reasons, you cannot upload files via ajax. The only solution is to use an iframe or popup window.

        Comment

        • ak1dnar
          Recognized Expert Top Contributor
          • Jan 2007
          • 1584

          #5
          Hi there,

          I didn't try this yet, but may be helpfull for you.
          Class: AJAX File Uploader

          Thanks,
          -Ajaxrand

          Comment

          • newlearner
            New Member
            • May 2007
            • 67

            #6
            Originally posted by ajaxrand
            Hi there,

            I didn't try this yet, but may be helpfull for you.
            Class: AJAX File Uploader

            Thanks,
            -Ajaxrand
            Yes i tried out file uploader already. the uploading file was ina traditional way with form method and post. I was curious aout doing it in ajax alone.

            Thanks for ur valuable suggestions..
            - newlearner

            Comment

            • ak1dnar
              Recognized Expert Top Contributor
              • Jan 2007
              • 1584

              #7
              Originally posted by newlearner
              Yes i tried out file uploader already. the uploading file was ina traditional way with form method and post. I was curious aout doing it in ajax alone.

              Thanks for ur valuable suggestions..
              - newlearner
              Oh really,
              That's why I said I also didn't try it yet.Then no luck refer to the pbmods's post.

              Comment

              Working...