0 Replies Latest reply on Jun 27, 2011 2:16 PM by JChap302

    Help with file uploader, php script, Windows Authentication

    JChap302

      I am trying to setup a really basic web-based file uploader that I will expand upon later. I have the flex application working well enough (very basic). However, I have a php script in a secure folder using windows authentication. When I try to send the file to the script, it doesn't seem to like my credentials, and refuses to do anything. I do not get an error message; just nothing happens.

       

      My questions are:

       

      Does anybody know where I should've looked before posting this thread?

      Do I even have PHP set up correctly? (At first I just made a txt file and put a .php extension on it, then I tried to setup PHP on the server, but it was a little confusing for me)

      Is Windows Authentication the problem?

      I do plan on implementing SQL Server in the future (to keep track of Files and user-defined attributes for files), but I do not want to store the files in SQLserver, just their pathnames.

      Is there a simple way to use ColdFusion (for free) to acheive this end?

       

      I am somewhat experienced at coding applications, but am totally new to server-side scripts.

       

      This is my php script:

       

      <?php
      
      $tempFile = $_FILES['Filedata']['tmp_name'];
      $fileName = $_FILES['Filedata']['name'];
      $fileSize = $_FILES['Filedata']['size'];
      
      move_uploaded_file($tempFile, "./" . $fileName);
      
      ?>


      This is my flex application:

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                        xmlns:s="library://ns.adobe.com/flex/spark"
                        xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

      <fx:Script>
           <![CDATA[

           private var fileRef:FileReference
           private var uploadFilePath:String
           
           private function selectFile():void
           {
                fileRef = new FileReference();
                fileRef.addEventListener(Event.SELECT, fileRef_select);
                fileRef.browse();
           }
                
           private function fileRef_select(evt:Event):void
           {
                fileRef.upload(new URLRequest("http://SERVERLOCATION/PDFUploader.php"));
           }     
           ]]>

      </fx:Script>
           <s:Button top="30" left="5" label="Browse" click="selectFile()"/>
      </s:Application>

      Thanks to any who take the time to respond.