Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3226334
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:26:37+00:00 2026-05-17T16:26:37+00:00

Adobe reference specifically points this out as a limitation. Here’s the note in the

  • 0

Adobe reference specifically points this out as a limitation.

Here’s the note in the file.upload functionality in adobe reference.

Note: If your server requires user authentication, only SWF files running in a browser — that is, using the browser plug-in or ActiveX control — can provide a dialog box to prompt the user for a username and password for authentication, and only for downloads. For uploads using the plug-in or ActiveX control, or for uploads and downloads using the stand-alone or external player, the file transfer fails.

click here for the full reference page for File

Has anyone been able to work around this limitation. One thought I had was to use the native support in AIR for Javascript and see that works. Anyone tried that? Anyone have other ideas?

I’ve also tried the solution proposed here and it didn’t work. According to the questioner in the forum it didn’t seem to work for him either. Probably hitting the issue/limitation mentioned above.

I understand how to include basic authentication on a URLRequest and that works fine for me if I’m posting key/value pairs. But when I attempt to upload a file it does not work. It just sits there and does not fire any of the file.upload events. No errors no progress. Any help is much appreciated.

Here’s my sample code:

            var sendVars:URLVariables = new URLVariables();
        sendVars.prop1 = "filename" ;

        var urlRequest:URLRequest = new URLRequest();
        urlRequest.method = URLRequestMethod.POST ;
        urlRequest.data = sendVars ;

        var encoder:Base64Encoder = new Base64Encoder();
        encoder.encode("user:pass"); 
        var credsHeader:URLRequestHeader = new URLRequestHeader("Authorization", "Basic " + encoder.toString());            

        urlRequest.requestHeaders.push(credsHeader); 

        file = new File(url);

        file.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA , file_UploadCompleteDataHandler );            
        file.addEventListener( Event.OPEN, fileOpenHandler);
        file.addEventListener(ProgressEvent.PROGRESS, fileProgressHandler);
        file.addEventListener(Event.COMPLETE, file_CompleteHandler);
        file.addEventListener(IOErrorEvent.IO_ERROR, file_IOErrorHandler);
        file.addEventListener(HTTPStatusEvent.HTTP_STATUS , file_HTTPStatusHandler);
        file.addEventListener(SecurityErrorEvent.SECURITY_ERROR, file_SecurityErrorHandler);

        try {
            // Start the file upload
            file.upload(urlRequest, "primaryFile", false);
        }
        catch (error:Error) {
            trace( "Unable to upload file." + file.name);
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T16:26:38+00:00Added an answer on May 17, 2026 at 4:26 pm

    Do exactly what you are doing except get the file.data and pass it into this….

        public static function prepareWithFormData(vars:MetadataList, bytes:ByteArray, fieldName:String, filename:String, request:URLRequest):void {
            bytes.position = 0;
            var boundary: String = '---------------------------' + UIDUtil.createUID();
            var header1: String  = "";
            var varsArray:Array = vars.asArray();
            for each(var item:Metadata in varsArray) {
                header1 += "\r\n--" + boundary + "\r\n";
                header1 += 'Content-Disposition: form-data; name="' + item.name + '"\r\n\r\n';
                header1 += item.value;
            }
    
            header1 += '\r\n--'+boundary + '\r\n'
                    +'Content-Disposition: form-data; name="' + fieldName + '"; filename="'+filename+'"\r\n'
                    +'Content-Type: application/octet-stream\r\n\r\n'
            //In a normal POST header, you'd find the image data here
            var header2:String =    '\r\n--'+boundary + '--';
    
            //Encoding the two string parts of the header
            var headerBytes1: ByteArray = new ByteArray();
            headerBytes1.writeMultiByte(header1, "ascii");
    
            var headerBytes2: ByteArray = new ByteArray();
            headerBytes2.writeMultiByte(header2, "ascii");
    
            //Creating one final ByteArray
            var sendBytes: ByteArray = new ByteArray();
            sendBytes.writeBytes(headerBytes1, 0, headerBytes1.length);
            sendBytes.writeBytes(bytes, 0, bytes.length);
            sendBytes.writeBytes(headerBytes2, 0, headerBytes2.length);
    
            request.data = sendBytes;
            request.method = URLRequestMethod.POST;
            request.contentType = "multipart/form-data; boundary=" + boundary;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Adobe has a very clear explanation here : A bound method, sometimes called a
The ActionScript 3.0 Reference says the following about flash.net.NetConnection : The NetConnection class creates
I've been reading through the adobe pdf spec, along with apple's quartz 2d documentation
I am developing UI for a Wpf application. I have designs build by designer
How do I programatically detect from Flex/Actionscript the STRING representing the current security domain,
I'm trying to print a PDF with Python, without opening the PDF viewer application
The CSS rule @page {size: landscape;} is supposed to force browsers to print pages
I have used Flash Builder 4 built-in help viewer, and I'm pretty sure there
I am calling com.facebook.graph.Facebook.init(APP_ID, loginHandler); to log in to facebook using the actionscript api

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.