9 Replies Latest reply on Oct 23, 2012 3:47 PM by kglad

    suddenly get http error on file uplaod

    chopTheWood Level 1

      I've had this program running for years with no problem. Now, when I go to upload a .jpg file I get an http error.  The code that gives the error results is:

       

      listener.onHTTPError = function(file:FileReference):Void {

      results_txt.text =("onHTTPError: " + file.name);

      };

       

      I call on a php script to do the uploading but I haven't touched it in years.

       

      What does such an error indicate? I'm not sure where to begin. I haven't looked at this code in so long that I've forgotten a lot about it.

       

      Is there something I can add to the code above to give me more information than simply the file name:

      onHTTPError: gillCover.jpg

       

      ADDENDUM:

      I found that the error code is 302. I found this about the error also:

       

      302 is not an error. It is the HTTP status code for "moved temporarily," which tells the Web browser / search engine that it should continue using the URL it used in the first place.

       

      A 302 redirect is common when using mod_rewrite, PHP's header() and other such URL-changing schemes.

       

      People will tell you 302 redirects hurt your search engine rankings. That's bunk; there's so many of them out there, they're largely ignored. However, you can change redirection methods to send 301 -- moved permanently -- instead, if you are especially paranoid.

       

      Any help appreciated.

       

      thanks,

      chopWood

        • 1. Re: suddenly get http error on file uplaod
          kglad Adobe Community Professional & MVP

          the FileReference class isn't available in as2.  do you have a custom FileReference class?

          • 2. Re: suddenly get http error on file uplaod
            chopTheWood Level 1

            Not that I'm aware of. I'm publishing as as2. I changed the script a little to give me the http error code instead of the file name and it gave me the 302 msg.

            • 3. Re: suddenly get http error on file uplaod
              chopTheWood Level 1

              I just discovered that things are worse than I thought. I have several clients on the same hosting service and none of them can upload images anymore because of the same error. Something must have changes on the server I guess. Something must have been moved or redirected.....

              This is a bad day.

               

              I suppose I need to contact tech support.

               

              I might have something to do with the .php file that is uploading the image. In it I am using IMAGE MAGICK. Could that particular libraru have been changed?

               

              thanks

              • 4. Re: suddenly get http error on file uplaod
                kglad Adobe Community Professional & MVP

                my mistake.  there was a filereference class introduced with flash 8.

                 

                p.s.  you may have a security error.  what's your url and what needs to be done to see the problem.

                • 5. Re: suddenly get http error on file uplaod
                  chopTheWood Level 1

                  Here's what has happened since:

                   

                  1. Tech support from the hosting company reported that it worked fine for them. I check for the upload and sure enough the image was there.

                   

                  2. Two other people that have different ISP's reported that they get the http error 302

                   

                  3. One other person said that the upload program reported "Success" instead of an error. However, when I checked, the file was not there. Several attempts were make with the sam result - no file uploaded.

                   

                  4. I have tried using Google Chrome, Safari, Firefox, all with the same result: error 302

                   

                  I can send you the URL for you to try, however it is a part of my clients CMS and can't post it here. Would you like me to do that?

                   

                  I should also note that from the same CMS editor that uplaods images, one can also edit and save text. This is working just fine.

                  • 6. Re: suddenly get http error on file uplaod
                    kglad Adobe Community Professional & MVP

                    sure, send a private message.

                    • 7. Re: suddenly get http error on file uplaod
                      kglad Adobe Community Professional & MVP

                      in your php you're moving the file from a temp location to elsewhere.  what code are you using?

                      • 8. Re: suddenly get http error on file uplaod
                        chopTheWood Level 1

                        This is the .php file that is accessed from within the Flash editor program (the URL which I sent to you).  It uploads the file and changes the size to 475 px max and makes a thumbnail version of the same image. I had a theory earlier on that the Image Magick library might have been moved. But then, I don't really know why I think that.. just a wild guess. Funny though, that only the tech support at the host was able to use it successfully. Also, I haven't changed this php file in years (literally) and it has always worked.

                         

                        /*

                        Upload an image and resize it to a maximum size as expressed in $max_widthLarge and

                        $max_widthHeight. Save it to the "largeImages" folder, then save a thumnail size of the

                        same image (six being $max_widthThumb,$max_heightThumb) in the thumbImages folder.

                        If the original image is already smaller than ($max_widthLarge and $max_widthHeight) then

                        only the thumb will be resized smaller. The large image will not be stretched larger to meet

                        the "$max" values.

                        The file name will be stripped of any illegal characters.

                        */

                         

                        <?

                        $originalFiledata_image = $_FILES[Filedata][tmp_name];

                        $FiledataName=$_FILES['Filedata']['name'];

                        $tempName=$FiledataName;

                        //

                        // ----- remove unwanted chars from the file name -------

                        $tempName= eregi_replace(",","",$tempName);

                        $tempName= eregi_replace(" ","",$tempName);

                        $tempName= eregi_replace("_","",$tempName);

                        $tempName= eregi_replace("&","",$tempName);

                        $tempName= eregi_replace(";","",$tempName);

                        $tempName= eregi_replace("\+","",$tempName);

                        $tempName= eregi_replace("\"","",$tempName);

                        $tempName= eregi_replace("\'","",$tempName);

                        $FiledataName=$tempName;

                        // -------- end unwanted chars -----------

                        //

                        //

                        // ------------- get the dimensions of the uploading image ------------

                        list($width, $height, $type, $attr) = getimagesize($originalFiledata_image );

                        if ($width>=$height){

                        $longestSide=$width;

                        } else {

                        $longestSide = $height;

                        }

                        // ----------- end get dimensions -------------------------------------------

                        //

                         

                        $descriptor=$_GET['insertDescriptor'];

                        $len=strlen($FiledataName);

                        $FiledataName=substr_replace($FiledataName,$descriptor,($len-4),0);

                        // set the jpg quality for Image Magick

                        $theQualityLarge=80;

                        $theQualityThumb=65;

                        // Get the image dimensions for Image Magick

                        $sizeLarge=GetImageSize( $originalFiledata_image );

                        // Maximum image width for Image Magick

                        $max_widthLarge = "475";

                        $max_heightLarge = "475";

                        $max_widthThumb = "75";

                        $max_heightThumb = "75";

                        //

                        // We don't want to stretch an image, so if it's already smaller than the "max"

                        // size, then change the max sizes to its current size

                        //

                        if ($max_widthLarge>$longestSide) {

                        $max_widthLarge=$longestSide;

                        $max_heightLarge=$longestSide;

                        }

                         

                        // remove all whitespace from the string

                        $newStr = ereg_replace('[[:space:]]+', '', trim($FiledataName));

                        $FiledataName=$newStr;

                        // Resize the image

                        // ------------------------ IMAGE MAGICK ---------------------------

                        exec("convert -size {$sizeLarge[0]}x{$sizeLarge[1]}  $originalFiledata_image -thumbnail {$max_widthLarge}x{$max_heightLarge} -quality $theQualityLarge /home/lindagun/public_html/largeImages/".$FiledataName);

                        exec("convert -size {$sizeLarge[0]}x{$sizeLarge[1]}  $originalFiledata_image -thumbnail {$max_widthThumb}x{$max_heightThumb} -quality $theQualityThumb /home/lindagun/public_html/thumbImages/".$FiledataName);

                        //------------------------------------------------------------------

                         

                        ?>

                        • 9. Re: suddenly get http error on file uplaod
                          kglad Adobe Community Professional & MVP

                          i'm not familiar with image magick so i'm not going to be able to help you with that.