2 Replies Latest reply on Nov 11, 2008 4:44 AM by flexchief

    Upload file to server problem

      I am trying to upload a file from my local machine to a server that hosts my website.

      I've been able to do this using a html form (simpleupload.html) and a php script (uploader.php). The user simply chooses a file from their local machine and then clicks upload. Upon a successful upload the file simply gets added to a folder named 'uploads' on my server.

      I have tried to set up an AIR application (FileUpload.mxml) that allows a user to do exactly the same thing. The code uses the same php script on the server side and completes successfully. However when I check the uploads folder on my server the file that should have been uploaded is nowhere to be found.

      Does anyone know why this is?
        • 1. Re: Upload file to server problem
          ilsh Level 1
          Is the name of the file field "Filedata" in your php script?

          Here is a snippet of my code "uploader.php" which works:
          if(move_uploaded_file($_FILES['Filedata']['tmp_name'], $foldername))
          print "success";
          print "fail";
          • 2. Re: Upload file to server problem
            flexchief Level 1
            Excellent! That's my problem exactly!

            The file name in my AIR app was 'File' but the file field in my php script was 'uploadedfile'. After changing the AIR app file name to 'uploadedfile' my upload worked and could be found on my server.

            Thank you very much for help ilsh you are a legend ;-)