spiroosx
asked on
Flash 8 FileReference Upload on SSL???
Hi All,
I am frantically trying to get this the new FileReference function in Flash 8 to work under ssl.
It says it can support ssl but the files are never uploaded. Http OK / HTTPS not OK.
A demo of it running can be found here: http://www.tink.ws/blog/files/flash8/UploadExample.html (not my site)
and the source here: http://www.tink.ws/blog/files/flash8/FileReference.zip
What do i need to alter to make it work. I have changed all the tags to https but no change all that happens is the status bar sits at zero % and the text just continually says "upload started".
Any advice would be greatly appreciated.
Many thanks in advance
spiroosx
I am frantically trying to get this the new FileReference function in Flash 8 to work under ssl.
It says it can support ssl but the files are never uploaded. Http OK / HTTPS not OK.
A demo of it running can be found here: http://www.tink.ws/blog/files/flash8/UploadExample.html (not my site)
and the source here: http://www.tink.ws/blog/files/flash8/FileReference.zip
What do i need to alter to make it work. I have changed all the tags to https but no change all that happens is the status bar sits at zero % and the text just continually says "upload started".
Any advice would be greatly appreciated.
Many thanks in advance
spiroosx
ASKER
Hi Miles,
Thank you for coming back to me :-)
I have tried your solution and unfortunatley i am a little uncear as to where the port is specified.
The setup i have is all the contents of http://www.tink.ws/blog/files/flash8/FileReference.zip
uploaded into a folder called "upload"
so the path to this folder is:
https://www.mysite.co.uk/upload/UploadExample.html
I have changed the tags in the html page to be https.
Obviously if i enter https://www.mysite.co.uk:443/upload/UploadExample.html nothing happens so i then have gone through the imported .as file shown below:
Would i change: success = this._fileRef.upload(Uploa dExample.U RL);
to: success = this._fileRef.upload(https://www.mysite.co.uk:443/upload/); ???
Any further help would be greatly appreciated.
Many thanks
spiroosx
////////////////////////// ////////// /////////
//Imports
////////////////////////// ////////// /////////
import mx.utils.Delegate;
import mx.controls.TextArea;
import mx.controls.ProgressBar;
import mx.controls.Button;
import flash.net.FileReference;
////////////////////////// ////////// /////////
////////////////////////// ////////// /////////
class UploadExample extends MovieClip
{
////////////////////////// ////////// /////////
//Components
////////////////////////// ////////// /////////
//TextArea component
private var _textArea:TextArea;
//ProgressBar component
private var _progressBar:ProgressBar;
//Button components
private var _browse_btn:Button;
private var _upload_btn:Button;
////////////////////////// ////////// /////////
////////////////////////// ////////// /////////
////////////////////////// ////////// /////////
//FileReference object
////////////////////////// ////////// /////////
private var _fileRef:FileReference;
////////////////////////// ////////// /////////
////////////////////////// ////////// /////////
////////////////////////// ////////// /////////
//server script configured to handle upload through HTTP POST calls
////////////////////////// ////////// /////////
private static var URL:String = "upload.php";
////////////////////////// ////////// /////////
////////////////////////// ////////// /////////
////////////////////////// ////////// /////////
//Constructor
////////////////////////// ////////// /////////
public function UploadExample()
{
super();
}
////////////////////////// ////////// /////////
////////////////////////// ////////// /////////
////////////////////////// ////////// /////////
//onLoad
////////////////////////// ////////// /////////
private function onLoad():Void
{
this._textArea.fontSize = 15;
this._progressBar.mode = "manual";
this._browse_btn.label = "Browse";
this._browse_btn.onPress = Delegate.create(this, this.browse);
this._upload_btn.label = "Upload";
this._upload_btn.onPress = Delegate.create(this, this.upload);
this._fileRef = new FileReference();
this._fileRef.addListener( this);
}
////////////////////////// ////////// /////////
////////////////////////// ////////// /////////
////////////////////////// ////////// /////////
//Button events
////////////////////////// ////////// /////////
private function browse():Void
{
var success:Boolean;
//open OS window and specify a description for each group and the file types allowed in that group
success = this._fileRef.browse([{des cription: "All Formats (*.jpg,*.gif,*.png,*.swf)" , extension: "*.jpg;*.gif;*.png;*.swf", macType: "JPEG;jp2_;GIFF;SWFL"},
{description: "All Image Formats (*.jpg,*.gif,*.png)", extension: "*.jpg;*.gif;*.png", macType: "JPEG;jp2_;GIFF"},
{description: "Flash Movies (*.swf)", extension: "*.swf", macType: "SWFL"}]);
//if the OS window failed to open
if(success == false)
{
this._textArea.text += "OS window failed to open\n//////////////////// ////////// ////////// ////////// ////////// ////////// //////\n\n ";
this._textArea.vPosition = this._textArea.maxVPositio n;
}
}
private function upload():Void
{
var success:Boolean;
//start upload process
success = this._fileRef.upload(Uploa dExample.U RL);
//if the upload process failed to start
if(success == false)
{
this._textArea.text += "upload process failed to start\n/////////////////// ////////// ////////// ////////// ////////// ////////// ///////\n\ n";
this._textArea.vPosition = this._textArea.maxVPositio n;
}
}
////////////////////////// ////////// /////////
////////////////////////// ////////// /////////
////////////////////////// ////////// /////////
//FileReference events
////////////////////////// ////////// /////////
private function onSelect(fileRef:FileRefer ence):Void
{
this._textArea.text += "file selected to upload\n\n";
this._textArea.text += "file details\n";
this._textArea.text += "name: " + fileRef.name + "\n";
this._textArea.text += "type: " + fileRef.type + "\n";
this._textArea.text += "size: " + fileRef.size + "\n";
this._textArea.text += "creator: " + fileRef.creator + "\n";
this._textArea.text += "created: " + fileRef.creationDate + "\n";
this._textArea.text += "last modified: " + fileRef.modificationDate + "\n/////////////////////// ////////// ////////// ////////// ////////// ////////// ///\n\n";
this._textArea.vPosition = this._textArea.maxVPositio n;
}
private function onOpen(fileRef:FileReferen ce):Void
{
this._textArea.text += "upload started\n///////////////// ////////// ////////// ////////// ////////// ////////// /////////\ n\n";
this._textArea.vPosition = this._textArea.maxVPositio n;
}
private function onProgress(fileRef:FileRef erence, loaded_num:Number, total_num:Number):Void
{
this._progressBar.setProgr ess(loaded _num, total_num);
}
private function onComplete(fileRef:FileRef erence):Vo id
{
this._progressBar.setProgr ess(100, 100);
this._textArea.text += "upload successful\n////////////// ////////// ////////// ////////// ////////// ////////// ////////// //\n\n";
this._textArea.vPosition = this._textArea.maxVPositio n;
}
private function onCancel():Void
{
this._textArea.text += "OS window dismissed\n/////////////// ////////// ////////// ////////// ////////// ////////// ////////// /\n\n";
}
private function onHTTPError(fileRef:FileRe ference):V oid
{
this._textArea.text += "onHTTPError: " + fileRef.name + "\n/////////////////////// ////////// ////////// ////////// ////////// ////////// ///\n\n";
this._textArea.vPosition = this._textArea.maxVPositio n;
}
private function onIOError(fileRef:FileRefe rence):Voi d
{
this._textArea.text += "onIOError: " + fileRef.name + "\n/////////////////////// ////////// ////////// ////////// ////////// ////////// ///\n\n";
this._textArea.vPosition = this._textArea.maxVPositio n;
}
private function onSecurityError(fileRef:Fi leReferenc e, error_str:String):Void
{
this._textArea.text += "onSecurityError: " + fileRef.name + " error : " + error_str + "\n/////////////////////// ////////// ////////// ////////// ////////// ////////// ///\n\n";
this._textArea.vPosition = this._textArea.maxVPositio n;
}
////////////////////////// ////////// /////////
////////////////////////// ////////// /////////
}
Thank you for coming back to me :-)
I have tried your solution and unfortunatley i am a little uncear as to where the port is specified.
The setup i have is all the contents of http://www.tink.ws/blog/files/flash8/FileReference.zip
uploaded into a folder called "upload"
so the path to this folder is:
https://www.mysite.co.uk/upload/UploadExample.html
I have changed the tags in the html page to be https.
Obviously if i enter https://www.mysite.co.uk:443/upload/UploadExample.html nothing happens so i then have gone through the imported .as file shown below:
Would i change: success = this._fileRef.upload(Uploa
to: success = this._fileRef.upload(https://www.mysite.co.uk:443/upload/); ???
Any further help would be greatly appreciated.
Many thanks
spiroosx
//////////////////////////
//Imports
//////////////////////////
import mx.utils.Delegate;
import mx.controls.TextArea;
import mx.controls.ProgressBar;
import mx.controls.Button;
import flash.net.FileReference;
//////////////////////////
//////////////////////////
class UploadExample extends MovieClip
{
//////////////////////////
//Components
//////////////////////////
//TextArea component
private var _textArea:TextArea;
//ProgressBar component
private var _progressBar:ProgressBar;
//Button components
private var _browse_btn:Button;
private var _upload_btn:Button;
//////////////////////////
//////////////////////////
//////////////////////////
//FileReference object
//////////////////////////
private var _fileRef:FileReference;
//////////////////////////
//////////////////////////
//////////////////////////
//server script configured to handle upload through HTTP POST calls
//////////////////////////
private static var URL:String = "upload.php";
//////////////////////////
//////////////////////////
//////////////////////////
//Constructor
//////////////////////////
public function UploadExample()
{
super();
}
//////////////////////////
//////////////////////////
//////////////////////////
//onLoad
//////////////////////////
private function onLoad():Void
{
this._textArea.fontSize = 15;
this._progressBar.mode = "manual";
this._browse_btn.label = "Browse";
this._browse_btn.onPress = Delegate.create(this, this.browse);
this._upload_btn.label = "Upload";
this._upload_btn.onPress = Delegate.create(this, this.upload);
this._fileRef = new FileReference();
this._fileRef.addListener(
}
//////////////////////////
//////////////////////////
//////////////////////////
//Button events
//////////////////////////
private function browse():Void
{
var success:Boolean;
//open OS window and specify a description for each group and the file types allowed in that group
success = this._fileRef.browse([{des
{description: "All Image Formats (*.jpg,*.gif,*.png)", extension: "*.jpg;*.gif;*.png", macType: "JPEG;jp2_;GIFF"},
{description: "Flash Movies (*.swf)", extension: "*.swf", macType: "SWFL"}]);
//if the OS window failed to open
if(success == false)
{
this._textArea.text += "OS window failed to open\n////////////////////
this._textArea.vPosition = this._textArea.maxVPositio
}
}
private function upload():Void
{
var success:Boolean;
//start upload process
success = this._fileRef.upload(Uploa
//if the upload process failed to start
if(success == false)
{
this._textArea.text += "upload process failed to start\n///////////////////
this._textArea.vPosition = this._textArea.maxVPositio
}
}
//////////////////////////
//////////////////////////
//////////////////////////
//FileReference events
//////////////////////////
private function onSelect(fileRef:FileRefer
{
this._textArea.text += "file selected to upload\n\n";
this._textArea.text += "file details\n";
this._textArea.text += "name: " + fileRef.name + "\n";
this._textArea.text += "type: " + fileRef.type + "\n";
this._textArea.text += "size: " + fileRef.size + "\n";
this._textArea.text += "creator: " + fileRef.creator + "\n";
this._textArea.text += "created: " + fileRef.creationDate + "\n";
this._textArea.text += "last modified: " + fileRef.modificationDate + "\n///////////////////////
this._textArea.vPosition = this._textArea.maxVPositio
}
private function onOpen(fileRef:FileReferen
{
this._textArea.text += "upload started\n/////////////////
this._textArea.vPosition = this._textArea.maxVPositio
}
private function onProgress(fileRef:FileRef
{
this._progressBar.setProgr
}
private function onComplete(fileRef:FileRef
{
this._progressBar.setProgr
this._textArea.text += "upload successful\n//////////////
this._textArea.vPosition = this._textArea.maxVPositio
}
private function onCancel():Void
{
this._textArea.text += "OS window dismissed\n///////////////
}
private function onHTTPError(fileRef:FileRe
{
this._textArea.text += "onHTTPError: " + fileRef.name + "\n///////////////////////
this._textArea.vPosition = this._textArea.maxVPositio
}
private function onIOError(fileRef:FileRefe
{
this._textArea.text += "onIOError: " + fileRef.name + "\n///////////////////////
this._textArea.vPosition = this._textArea.maxVPositio
}
private function onSecurityError(fileRef:Fi
{
this._textArea.text += "onSecurityError: " + fileRef.name + " error : " + error_str + "\n///////////////////////
this._textArea.vPosition = this._textArea.maxVPositio
}
//////////////////////////
//////////////////////////
}
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Hi Miles.
Thank you very much - you have made my week :-)
That works great
Cheers
spiroosx
Thank you very much - you have made my week :-)
That works great
Cheers
spiroosx
Hello Spiroosx,
I am very pleased to be of assistance! Good luck with the project...
Miles
I am very pleased to be of assistance! Good luck with the project...
Miles
I spent hours (no, days!) trying to work this out. I develop online web applictions and needed to use FileReference over SSL.
If you have got everything else sorted, all you need to do is to specify ':443' after the domain name to are uploading/downloading from. And of course make sure you have 'https'! So for example:
blahblah.upload('https://www.yourdomain.com:443/files/stuff/whatever')
Flash defaults to using port 80, which is for http. Even if you specify https at the beginning of the URL.
I really hope this works for you. I know how frustrating this can be!!
Miles