0 Replies Latest reply on Dec 18, 2006 10:15 AM by rambo3

    Uload image   and php

    rambo3
      How do i get imagename back with this sevice.

      Namely php script that is called renames files if duplicated or returns null if image is to large or ins't an image
      I need this also for removing images too.

      So in short : how to i get back the value that php returns after URLreqest has done $_POST.

      XMLX :

      private function uploadeImage():void{
      var request:URLRequest = new URLRequest("login_and_upload.php");
      var params:URLVariables = new URLVariables();
      fr = new FileReference();
      var allTypes:Array = new Array(imageTypes);
      fr.addEventListener(Event.SELECT, selectHandler);
      fr.addEventListener(ProgressEvent.PROGRESS, progressHandler);
      fr.addEventListener(Event.COMPLETE, completeHandler);
      fr.addEventListener(flash.events.IOErrorEvent.IO_ERROR , ioErrorHandler);
      fr.addEventListener(flash.events.SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
      fr.browse(allTypes);

      function selectHandler(event:Event):void {

      params.cmd = "uploadimage";
      params.username=username;
      params.password=password;

      request.method = URLRequestMethod.POST;
      request.data = params;
      pb.label = "DOWNLOADING %3%%";
      fr.upload(request);
      }
      function progressHandler(event:ProgressEvent):void {
      pb.setProgress(event.bytesLoaded, event.bytesTotal);
      }
      function completeHandler(event:Event):void {
      //uploadimagepath.text=request.
      //uploadimagepath.text=fr.name.toString();
      pb.label = "DOWNLOAD COMPLETE";
      }
      function ioErrorHandler(e:IOErrorEvent):void{
      Alert.show(e.text);
      }
      function securityErrorHandler(e:SecurityErrorEvent):void{
      Alert.show(e.text);
      }
      }