Note that there are some explanatory texts on larger screens.

plurals
  1. POAdobe Flex to pure Action Script. How?
    primarykey
    data
    text
    <p>I have the following script which allows files to be upload through a PHP script into my web server but I was hoping to turn pseudo code into pure action script. Also, for some reason, my progress bar doesn't display the actual progress of the file upload.</p> <p><strong>Here's the PHP code:</strong></p> <pre><code>&lt;?php $tempFile = $_FILES['Filedata']['tmp_name']; $fileName = $_FILES['Filedata']['name']; $fileSize = $_FILES['Filedata']['size']; move_uploaded_file($tempFile, "./" . $fileName); ?&gt; </code></pre> <p><strong>Here's the Adobe Flex code:</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" width="225" height="178" minWidth="955" minHeight="600"&gt; &lt;fx:Declarations&gt; &lt;/fx:Declarations&gt; &lt;fx:Script&gt; &lt;![CDATA[ import flash.net.FileReference; public var fileRef:FileReference = new FileReference(); public function uploadDialog(e:MouseEvent):void{ errLabel.text=""; var imgType:FileFilter = new FileFilter("Images (*.GIF,*.JPG,*.PNG)","*.gif;*.jpg;*.png"); var filterArray:Array=new Array(imgType); fileRef.browse(filterArray); fileRef.addEventListener(Event.SELECT,fileSelect); fileRef.addEventListener(ProgressEvent.PROGRESS,fileProgress); fileRef.addEventListener(Event.COMPLETE,fileComplete); } public function fileSelect(e:Event):void{ var fileURL:URLRequest = new URLRequest("upload.php"); try { //filepath.text=fileRef.name; fileRef.upload(fileURL); } catch (err:Error) { errLabel.text="Unable to Upload File....."; } } public function fileProgress(e:ProgressEvent):void { progBar.visible=true; } public function fileComplete(e:Event):void{ errLabel.text="File Uploaded Sucessfully....." progBar.visible=false; } ]]&gt; &lt;/fx:Script&gt; &lt;s:Label x="10" y="10" click="uploadDialog(event)" text="Upload ..."/&gt; &lt;mx:ProgressBar id="progBar" x="10" y="26"/&gt; &lt;s:Label id="errLabel" x="10" y="108" width="200" text="..."/&gt; &lt;/s:Application&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload