File.upload ActionScript does not work on Air SDK for iOS devices

I try to use the ActionScript File.upload to transfer a file on Air SDK for iOS environment, but the File.upload does not work properly. No event on the file upload handler is executed after File.upload is called, and no exception is caught. When I check the side network traffic server, I found no application http even didn't hit the server after execution of File.upload. The code is below.

------------------------------------------------------------------------------------------ -----------------------------------------------------------------------

<? XML version = "1.0" encoding = "utf-8"? >

" < = xmlns:fx s:View ' http://ns.Adobe.com/MXML/2009 "xmlns:s ="library://ns.adobe.com/flex/spark"title ="HomeView"> "

< fx:Declarations >

<! - Place non-visual elements (e.g., services, items of value) here - >

< / fx:Declarations >

< fx:Script >

<! [CDATA]

private var file:File;

private var dir:File;

This method is executed to create a file and download it when you press the download button.

protected void OnUploadButtonPressed(event: MouseEvent): void {}

trace ("upload button clicked");

var urlReq:URLRequest = new URLRequest ("http://10.60.99.31/MyPath/fileUploadTest.do");

urlReq.method = URLRequestMethod.POST;

var str:String = "this is test";

var imageBytes:ByteArray = new ByteArray();

for (var i: int = 0; i < str.length; i ++) {}

imageBytes.writeByte (str.charCodeAt (i));

}

trace ("size =" + imageBytes.length);

try {}

dir = File.applicationStorageDirectory

I also tested in several different directories

dir = File.createTempDirectory ();

dir = File.documentsDirectory;

var today: Date = new Date();

var filename:String = 'IMG' + now.fullYear + now.month + now.day + now.hours + now.minutes + now.seconds + now.milliseconds + ".txt";

file = dir.resolvePath (filename);

var stream: FileStream = new FileStream();

Stream.Open (file, FileMode.WRITE);

stream.writeBytes (imageBytes);

Stream.Close ();

Review the content of the file to check if the file is written successfully.

var readStream:FileStream = new FileStream();

readStream.open (file, FileMode.READ);

var: string result = readStream.readUTFBytes (readStream.bytesAvailable);

trace ("rear read result =" + result); The result is shown here as planned.

file.addEventListener (Event.COMPLETE, uploadComplete);

file.addEventListener (IOErrorEvent.IO_ERROR, ioError);

file.addEventListener (SecurityErrorEvent.SECURITY_ERROR, securityError);

file.addEventListener (ErrorEvent.ERROR, someError);

file.addEventListener (ProgressEvent.PROGRESS, onProgress);

file.upload (urlReq); This line does not work. No handler is executed. No http request struck the coast server.

trace ("after file upload test");

} catch (error) {}

trace (e);

}

}

Complete Manager

private function uploadComplete (event: Event): void

{

trace ("Upload successful.");

}

IOError handler

private void ioError (error: IOErrorEvent): void

{

trace ("Upload failed:"+ error.text ");

}

Manager SecurityError

private void securityError(error:SecurityErrorEvent):void {}

trace ("security error:" + error.text);

}

Another Manager

private void someError(error:ErrorEvent):void {}

trace ("an error" + error.text);

}

Progress Manager

private void onProgress(event:ProgressEvent):void {}

trace ("progressHandler");

}

This method is executed to call the URLLoader.load when the delicate touch.

protected void OnTrickyButtonPressed(event: MouseEvent): void {}

var urlReq:URLRequest = new URLRequest ("http://200.60.99.31/"); This points to a server not - exist

urlReq.method = URLRequestMethod.POST;

urlReq.data = new ByteArray();

var loader: URLLoader = new URLLoader();

try {}

Loader.Load (urlReq); This line is very important in iOS7. He decides if the latter file.upload may work.

But in iOS8, file.upload does not work even if that line is executed.

trace ("after urlloader load");

} catch (error) {}

trace (e);

}

}

[]] >

< / fx:Script >

< s:Button = "200" x = "200" width = "400" height = "200" label = "Upload" click = "OnUploadButtonPressed (event)" / > "

< s:Button = "200" x = "500" width = "400" height = "200" label = "Tricky" click = "OnTrickyButtonPressed (event)" / > "

< / s:View >

------------------------------------------------------------------------------------------ -----------------------------------------------------------------------


When it is run on the simulator of the Air, it works very well as expectedand the file is successfully downloaded to the server. But when run on iOS devices (in my case, iPad), as I explained at the beginning, no event on the file upload handler is executed and not the http request has even hit the server. So I think that the problem may come from the client side.

During my attempt to solve the problem, I found something complicated about this problem on iOS7. In other words, if you call the URLLoader.load method (although the URLLoader.load points to an address non-existed) before calling the File.upload method, the File.upload will work as expected on iOS7. Specifically, when the above OnTrickyButtonPressed method is run before the OnUploadButtonPressedmethod, File.upload will succeed on iOS7. But this only happens on iOS7. On iOS8, File.upload still refuses to work, regardless of knowing if the URLLoader.load is executed before.

I think in my case, the problem is not the problem of sandbox or a session of Firefox problem described in the two links below, because not even a http request hit the side server. It seems that the Air SDK for iOS comes to fail send the http reason request any.

http://StackOverflow.com/questions/5967382/Flex-4-FileReference-issues-with-Firefox

http://StackOverflow.com/questions/351258/how-do-i-make-Flex-file-upload-work-on-Firefox-a nd-safari

To make my problem clear, I list my environment below:

  • Development environment: Windows7 (64-bit) / Mac os 10.9.4 (tested on both OS platforms.)
  • IDE: Flash Builder 4.7
  • Air SDK: 3.8 / 16.0.0 (after that I have updated to the latest Air SDK 16.0.0, problem persists.)
  • Application server: Tomcat7 + spring

Finally, I want to mention that download the file using URLLoader.load isn't an option in my case because I want to download large files in the future, which cannot be addressed with the URLLoader.load.

I struggled with this for days. If I really appreciate it if anyone has an idea about this.

Thanks in advance.

Hi KA RYU.

We have reproduced the issue successfully, our team would work on it.

-Tushar

Tags: Adobe AIR

Similar Questions

  • Packer of creative cloud in creating a package that I can install do not.  He goes through the motions, download all updates, create setup file, but it does not work despite the fact that there are no errors in the log files

    Packer of creative cloud in creating a package that I can install do not.  He goes through the motions, download all updates, create setup file, but it does not work despite the fact that there are no errors in the log files

    After hitting my head against the desk to repeatedly create packages, try on different computers I have finally found a solution.

    These packages have been copied on an external drive, if I try and install from the external drive, which is a common practice, it fails.

    If I then copy this file pkg from the outside, to the computer I install, then run it, it will to and moved very well.

    That is mind-boggling stupid, because it's rare that you have to copy the file into any computer, it is less always installed off the coast of externally, and many people in the company are pushing on the network and the management of the suites so there is a serious problem in Adobe package manager if this is the case where it cannot manage the Middle installed offshore.

    I hope that if anyone else is having problems so it suits.

  • "File &gt; open recent" does not work.    Second problem: impossible to drag individual files or folders, from one place to the other.

    I recently installed Lightroom 6 (stand-alone version).  I have two separate issues: firstly the "file > open recent" does not work.  The cottage my last files but when I click on one of them, nothing happens (don't close the existing catalog, nothing new opens).

    Second problem: I can't drag individual files or folders, from one place to another within the section "Files" from the library.  I did this on a regular basis with older versions of LR so I know how it's done - it does everything just not in this new version.

    Thank you

    Chris

    I think that a Mac person will have to answer your question, I do not use Mac computers.

  • In the html content of dps, it has a url link to a pdf file. When click on url to load the pdf file, the zoom does not work

    I load html content in an application of dps.

    In the html page, there is a url to a pdf file. When I click on the url, the page loads a pdf file.

    Here's the question: is able to zoom in pdf?

    It's difficult because I can zoom in the first html page, but when I load a pdf file, zoom effect does not work.

    Please let me know if this is a way to make the pdf was able to zoom in.

    Thank you

    Post edited by: monsteryu

    No, this is not possible.

    Neil

  • AirPlay does not work on Apple TV with ios 10.  It was working before the update.  Please notify.

    AirPlay does not work on Apple TV with ios 10.  It was working before the update.  Please notify.

    Try these steps, check to see if things work after each step if necessary, before you try the next.

    1. Check AirPlay is on the Apple TV (turn market if it already is)
    2. Check that both devices are on the same network (settings > Wifi on the mobile device and the settings > general > network, on the Apple TV).
    3. Restart the Apple TV (settings > general > restart).
    4. Restart the Apple TV by removing ALL cables for 30 seconds.
    5. Restart your router. (Also try to remove the power cord for at least 30 seconds)
    6. Restart your computer or mobile device.

    If you're still having problems, try to use 802.11n for wifi if you currently use 802. 11B or 802. 11 g.

    If your problem is AirPlaying starting a computer, try turning off bluetooth

    If you're still having problems, the following article can help you.

    Troubleshooting AirPlay

    Troubleshooting connections and Wi - Fi networks

    Recommended Wi - Fi settings

    WiFi Diagnostic Software (for Mac users)

    You will also find help on this page, where I have collected some of the more unusual solutions for network problems.

  • "History &amp; clear Web site data" in Safari does not work on my iPhone 5 ios running 9.1.

    The "clear history and data from the Web site" in Safari does not work on my iPhone 5 ios running 9.1.

    How to determine you are exactly ?  It works fine on my 6s + 9.1 running.

  • Why my license code does not work on lightroom 6 for mac?

    Why my license code does not work on lightroom 6 for mac? My os x is "el capitan".

    Please try the steps to serialize Lightroom CC trial to activate like Lightroom 6 mentioned on: https://helpx.adobe.com/lightroom/kb/serialize-lightroom-cc-trial-to-activate-as-lightroom - 6.html

    You can also try: error "serial number is not valid for this product". Creative Suite

  • Why Apple does not have a backup battery for Apple devices?

    Why Apple does not have a backup battery for Apple device? Recommended us that of our full when we are on the road, so they should do a backup battery for their devices instead of other companies do. The backup battery that I use for my iPhone 5 c don't let my phone screen timeout as he does when I'm with the regular wall charger. Can anyone help?

    Consult the manual for your backup battery.  There should be a switch or a button to activate the phone load.  It should not be left in charge mode all the time because the phone thinks it has unlimited power when charging, so disabled several energy-saving features (like display sleep, closing a connection Wi - Fi when he sleeps).

  • Save to File.vi report does not work when integrated with the executable

    Hello

    When I use the NI_Report.lvclass:New Report.vi and NI_Report.lvclassave report to the File.vi, I can use successfully to create and excel spreadsheet so he was working at the developer.

    However when I build the source into an executable, this no longer works.  (The name of the file is built from the source, so I'm not using a dialog box)

    It can, however, create a .html file, but it does not seem as tidy.  Why is he not creating the Excel file?

    Running developer suite 2009, tried the .exe on Windows 7 and Windows XP with the same effect.

    Thank you

    -

    James

    See the attached zip file, it works for me here, see jpeg images and build the application accordingly and let us know. Did not include exe file, because the file size is too big.

  • path of the TestStand 4.2 file report "SpecifyByExpression" does not work

    I noticed that there is a problem in specific terms that has been fixed in 4.2.1

    Is not this problem.

    This is a problem when I select 'Specify report File Path by Expression' specify the expression to use, and then TestStand uses settings appropriate to the option "specific directory.

    I rechecked and it is quite reproducible.

    The phrase is: "\\Reports\\_ [] [] [] .xml'"

    But each time, the report file is generated by using the specific directory setting.

    Is there a solution for this?

    Thanks for any help.

    BTW, the "New Message" page on your site does not work in Opera 10.01 - I can not enter line breaks after the current line in the editor no HTML - line breaks go in front of the current line instead.

    I don't feel well in software TODAY. Entering the path expression of the report in HTML file is not my favorite activity!

    Nick-

    I'm a little confused as to what you mean. You have configured ReportOptions to specify the report by Expression file path? If so, the Locals.ReportOptions.DirectoryType property contains the string "SpecifyByExpression"? The directory 'C:\Documents and Settings\Temp\TestStand\Reports administrator' is where TestStand stores reports where the report should be saved on disk in the directory the Client's sequence file, but the file of the Client's sequence has not yet recorded on the disc.

    I followed the Locals.ReportOptions.DirectoryType and the Locals.ReportFilePath of the process template properties to check if they contain the appropriate strings.

    Determine the path of file report Expression is default SequentialModel.seq, where the expression is evaluated and the Locals.ReportFilePath property is set. You should check to see if this step is actually performed during your run and if the Locals.ReportFilePath property is on the right channel:

    I hope this helps.

  • Desktop icons can be seen on the desktop, folders are not able to be open, content is not visible; File save option does not work!

    Recently, I tried to re - install samsung smarthru mfp program (already installed and working except the scan).

    at the end of the reinstall the Office is empty, desktop wallpaper and all records of icons could not be seen, I wasn't able to use windows Explorer.

    I tried restoring the system, but even after that the message that the restore system was not made completely.

    Now the problems are that (1) folders/icons on the desktop are not displayed on the desktop (I have added Office to taskbar and all office files can be accessed from there.

    (2) the big problem is that folder except option does not work: cannot save Web pages, also the documents/files are not able to be saved after having published a new name.

    (3) new folder names the names of the files are not created.

    I tried norton internet security 2010 full scan, there is no virus.

    kindly help

    Thank you

    Norton will be interefe with system restore.

    Read this info for problems with the system restore:

    http://Service1.Symantec.com/support/sharedtech.nsf/pfdocs/2005113009323013

    1. If you use Norton (Etc), disable it before using System Restore. info at the link above.

    2. try SR in safe mode:

    Try typing F8 at startup and in the list of Boot selections, select Mode safe using ARROW top to go there > and then press ENTER.

    Try a restore of the system once, to choose a Restore Point prior to your problem...

    Click Start > programs > Accessories > system tools > system restore > choose another time > next > etc.

    3 Malware will stop at the system restore:

    If necessary, do all the workSafe Mode with network.

     

    To get intoSafe Mode with network, press F8 at the Power On / boot and use key arrow upward to get intoSafeMode with networking from the list of options, and then press ENTER.

    http://www.Malwarebytes.org/MBAM.php

    Malwarebytes is as its name suggests, a Malware Remover!

    Download the free Version from the link above.

    Download, install, upgrade and scan once a fortnight.

    See you soon.

    Mick Murphy - Microsoft partner

  • CS6 InDesign crashed, cannot restart (lack of fonts, cmap files). Reinstalled - does not work. Help?

    Hello

    my indesign CS6 worked perfectly until yesterday afternoon, when it crashed and wont open again all of a sudden. all it says is "there are fonts missing required system or cmap files. "Reinstall indesign." Done, with the cc cleaner, but it does not work!

    works on windows 7, sp1 - never had any problems.

    everything I can find in other forums on the cs2, which is quite outdated. Why this happens to you? all my other programs of the master collection work very well!

    Okay, after a frustrating weekend, the problem seems to have resolved itself. what I did (for future applications):

    -Downloaded cs6 master collection (since I had my CD not with me)

    -install old desinstallion

    -wipe the system with the cleaning of cc adobe tool everything down

    -Restart

    -install cs6

    -same error. no chance to do anything.

    I then installed a trial version on another computer to render at least my pdf. Then I tried something new: I put the WCPA & fonts (in C:/programs/Common Files/Adobe/PDFL) from the pc to work on a USB key. When I "supported" my PDFL folder on my pc main in a zip (just in case), I gave indesign another try. Then he started upward - since it was the first time a little slower than usual, but it's on track.

  • Responsive HTML5 with mergedprojects, creates a hyperlink to a file in the project html parent to a child html file and it does not work! The child has with the parent TOC, but need to tie. Help, please!

    Hi group!

    I have a brilliant parent project that serves as a springboard for other projects. Users click a component of software they want and are redirected to a page with a list of all the documentation available for this component. Click on the name of a document and access - a lot of PDF files. BUT I also wish they were able to tie the online help for the component. After having read up on the link through / between projects, I knew that I needed to create a parent project (for the page intro and links brilliant) and projects for children (for software components).

    THEN

    I created a parent sensitive HTML5 project and the projects of two children. I compiled the parent to create mergedprojects files, and then open the projects children and collected to the appropriate mergedprojects folder. I then created a hyperlink to the file list html documentation in the project parent towards the child file software component html (output folder and start page [which is the same as the default theme]) and the link does not work! The child and its table of contents appears in the parent TOC so topics are here, but I can't link to them. If necessary, I can send screenshots.

    Where I am dorking this place?

    Thanks in advance for your time and help!

    Scottie 'needs help' gear

    What is your relationship like? And how did you create the link?

    A typical reactive merged help is structured as follows:

    index.htm (Master home page)

    mergedProjects

    childName

    index.htm (starting page for child)

    A child from the index.htm page link would look like this:... /... index.htm

    Kind regards

    Willam

  • file &gt; create &gt; edgeProject does not work

    in photoshop;

    file > create > edgeProject

    does not work.

    in edgeReflow, the PS button isn't connecting to the PS

    I have been updated and thought I could start using it?

    This looks like a very good idea!

    Please notify.

    Eddie

    I thought her close CC and PS and reboot. all systems up and running now.

  • Struggling micro does not work. Installed Chipset for Dell Xps 420. Has been upgraded from vista to 7 64-bit

    Whenever I plug a microphone, the microphone taken none appears on the recording tab devices in the sound settings.

    The audio jack works well and worked even without the chipset drivers.

    I tried to download realtek but I get an error that says no drivers supported.

    Hello

    I couldn't find an update for Windows 7 for your computer, which means that Dell has not all drivers for this OS on your computer XPS 420. However, there is a driver that is specific to Vista 64-bit, download here: http://www.dell.com/support/drivers/us/en/19/DriverDetails/Product/xps-420?driverId=4JDG5&osCode=WV64&fileId=2731098634&languageCode=EN&categoryId=AU .

    Another option to consider is to update your video driver to the latest version, download here: http://www.nvidia.com/object/win8-win7-winvista-64bit-320.18-whql-driver.html (it was released on 23 May). I suggest as an alternative as video drivers often include audio drivers as well.

    Those are the two pilots who appear to be more likely to adapt to your system, and if one or the other does not work you can restore the driver using the dialog of properties as follows:

    1. Go to control panel and click Device Manager.
    2. When that opens, click sound, video and game controllers.
    3. Select the audio driver / video, you have downloaded and installed.
    4. Right-click on the device and select Properties.
    5. When this window opens, go to the tab (on the top row) driver.
    6. Click the Driver Rollback button and left-click on it.
    7. Let Windows reinstall the older driver.
    8. Restart your computer.

    If all goes well, one of these fixes will take care of the problem. Keep me posted.

    Kind regards

    BearPup

Maybe you are looking for