0 Replies Latest reply on Mar 15, 2010 4:47 PM by Max-San

    Passing data multiple times.

    Max-San

      Hi there. This place seems more useful than other boards for questions being answered so here it goes..

       

      What I intend this to do is; Upload a file > move to perm location > scan the header file for data > insert data back into a form > allow user to edit > submit to database.

       

      Any help would be highly appreciated.

       

      This is what I have so far.

       

      <?php

      $tempFile
      = $uploadFile['Filedata']['tmp_name'];
      $fileName = $uploadFile['Filedata']['name'];
      $fileSize = $uploadFile['Filedata']['size'];

      move_uploaded_file($tempFile, "./" . $fileName);

      ?>

       

                  private var fileUploadURL:String = "http://localhost/livetraxx/uploadFile.php"  
                  private var uploadFile:FileReference;
                 
                 
                  internal function browseForSet(e:Event):void {
                      uploadFile = new FileReference;
                      uploadFile.addEventListener(Event.SELECT, uploadFile_select);
                      uploadFile.addEventListener(ProgressEvent.PROGRESS, uploadFile_progress);
                      uploadFile.addEventListener(Event.COMPLETE, uploadFile_complete);
                      uploadFile.browse(getTypes());
                  }
                 
                  private function uploadFile_select(e:Event):void {
                      try {
                          message.text = "Set Size (bytes): "+ numberFormatter.format(uploadFile.size);
                          uploadFile.upload(new URLRequest(fileUploadURL));
                      } catch (err:Error) {
                          message.text = "ERROR: zero-byte file";
                      }
                  }
                 
                  private function getFilter():FileFilter {
                      return new FileFilter("Sounds (*.mp3, *.wma, *.ogg, *.m4a)", "*.mp3;*.wma;*.ogg;*.m4a");
                  }
                 
                  private function getTypes():Array {
                      var allTypes:Array = new Array(getFilter());
                      return allTypes;
                  }
                 
                  private function uploadFile_progress(e:ProgressEvent):void {
                      progressBar.visible = true;
                      fileSelected.text = uploadFile.name
                      //message.text =+ " Progress:" + numberFormatter.format(e.bytesLoaded)
                  }
                 
                  private function uploadFile_complete(e:Event):void {
                      message.text += " (complete)";
                      progressBar.visible = false;
                      id3Scan.token = filesService.id3Scan()
                     
                  }
                 
                  protected function submitData(e:Event):void {
                      writeData.token = filesService.createFiles(
                          [filename.text] +
                          [filesize.text]
                          [audio_dataformat.text] +
                          [audio_bitrate.text] +
                          [playtime_seconds.text] +
                          [title.text] +
                          [genre.text] +
                          [comment.text]);
                  }