FileReference
hi,
how can i change name of file will be upload with "FileReference" in flash ??
i know tha is just read-only ..
i had to rename that just on server ??
thanks a lot.
ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 10-16-2008, 07:05 AM
View Complete Forum Thread with Replies
Sponsored Links:
Filereference
having real difficulty with this class. can anyone explaain, in real terms
also, i dont think i understand it right, but COULD i load a sound from an end users computer, to the ram for use within the file, say using a sound in like a sampling environment
View Replies !
View Related
FileReference
hi i need help in uploading image using flash FileReference and PHP technology if anyone knows then do let me know. thanx in advance. plz do help me in this as i m stuck in it for quite a long time now.
once again thanx for taking out ur time to give me the solution.
psb
View Replies !
View Related
[AS2] FileReference
Dear All,
I tried to write an actionscript code to upload files. I used FileReference.
I debug every phases (onSelect,onCancel,onOpen,onProgress,onComplete,on IOError) and found out that my code stops on the onSelect. It does not say why it stops running. I have got no onIOError or any other error messages.
Any ideas of how can I make my debugging with more information ? I've google it, but the example I've got is pretty much what I have in my code.
Thanks.
View Replies !
View Related
[F8] Please Help With FileReference
Hi guys,
I'm 'playing' with the FileReference class. I've used the example provided within the help. My code looks like this one:
import flash.net.FileReference;
var selectedFile:FileReference;
var listener:Object = new Object();
uploadBtn.onPress = uploadImage;
var uploadDir:String = "./uploadedFiles/";
var pathUploadScript:String = "/_uploadScript.php";
listener.onSelect = function(selectedFile:FileReference):Void {
attachment = selectedFile.name;
selectedFile.upload(pathUploadScript+"?uploadDir=" +uploadDir);
};
function uploadImage(event:Object):Void {
imageFile.browse([{description:"Document", extension:"*.txt;*.doc;*.rtf"}]);
}
var imageFile:FileReference = new FileReference();
imageFile.addListener(listener);
listener.onOpen = function(selectedFile:FileReference):Void {
_invia.enabled = false;
_displai.htmlText = "<font color='#ff0000'>Uploading: "+selectedFile.name+"</font>";
};
listener.onComplete = function(selectedFile:FileReference):Void {
_displai.htmlText = "<font color='#ffffff'>"+selectedFile.name+"</font>";
attachment = selectedFile.name;
};
As you can see the file is uploaded as soon as it has been selected. Now, what I want to achieve is to upload the file when a button is pressed. I've tried several ways but no one works.
Any suggestion
Thanx, giano
View Replies !
View Related
FileReference
Hey, So I know I can use the FileReference Class to upload files from the users computer to the server. This seems to call one of microsoft's native browse windows, which only allows me to select files. Is there anyway I can set it up so the user has the option to just upload a whole folder? (Note: I know the user can just hold down SHIFT or CTRL to do multiple selects, Im more interested in letting them just select a folder and upload everything in it)
View Replies !
View Related
FileReference URL...?
Okay so I've begun experimenting with the FileReference class, and I'm using it as an mp3 player, where the user can go select a song to play (and add to their playlist and whatnot...).
I have managed to get the dialogue box up, and have it filter out everything but mp3 files, and they can select it and it populates the FileReference... but I cannot get the URL of it. The name property just returns "song.mp3", instead of the whole file path. Is there any way I can get the URL of the selected song, instead of just the name? Or is there any way I can create a sound object using a FileReference instead of the regular URLRequest?
Any help would be greatly appreciated,
Mavrisa
View Replies !
View Related
FileReference
Hi all
after AS2, these are my first steps in AS3.
I wanted to start with the Loader concept and then build up my OOP experience. Seems something wrong with the Filereference. Anyone can tell me ?
I copied below in an AS file, and created a FLA which references to this AS. Both are in the same folder (root), while the PDF is located in the subfolder /PDF.
_________________________________________
Code:
package {
import flash.display.Sprite;
import flash.events.*;
import flash.net.FileReference;
import flash.net.URLRequest;
import flash.net.FileFilter;
public class FileReference_download extends Sprite {
private var downloadURL:URLRequest;
private var fileName:String = "name.PDF";
private var file:FileReference;
public function FileReference_download() {
downloadURL = new URLRequest();
downloadURL.url = "http://www.mysite.com/PDF";
file = new FileReference();
configureListeners(file);
file.download(downloadURL, fileName);
}
private function configureListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.CANCEL, cancelHandler);
/* more Eventlisteners*/
dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
dispatcher.addEventListener(Event.SELECT, selectHandler);
}
private function cancelHandler(event:Event):void {
trace("cancelHandler: " + event);
}
/* more handlers */
}
}
View Replies !
View Related
FileReference In Air
Hey, I stumbled on a problem with FileReference when i was creating an air application.
I made a new FileReference and added an eventListener like this:
ActionScript Code:
...
var fr:FileReference = new FileReference();
fr.addEventListener(Event.SELECT,oSelect);
fr.browse();
}
private function oSelect(e:Event):void {
fr.load(); // Doesn't work
// fr.name gives me the file name but I need the full path
}
so why do I get this error, isn't fr.load supposed to work in AIR and how can I get the full path if I cant use that method?
View Replies !
View Related
FileReference URL
Hi all, I've a problem with filereference...I declare it and browse it like this:
Code:
var fr:FileReference = new FileReference()
fr.addEventListener(Event.SELECT, selezionato);
function selezionato(evt:Event):void {
trace(fr.url);
}
var tipifile:Array = [
new FileFilter("Immmagini (*.jpg, *.jpeg, *.gif, *.png)", "*.jpg; *.jpeg; *.gif; *.png"), ]
fr.browse(tipifile);
I want to know the complete local url of the file selected by filereference but I'm not able to get it... fr.url and fr.nativePath don't work...how can I solve it??
Cheers!
View Replies !
View Related
FileReference In AS 1?
Does anyone know how to use fileReference with AS1? It says it is available in AS1 in the help section, but gives no example. I am unsure how you would do >
import flash.net.FileReference;
in Actionscript 1.
Thanks.
View Replies !
View Related
MP3 And FileReference
Hello!
I am having either thought constipation or lack of knowledge or both. Or maybe I want too much.
My application allows user to select an MP3 file from his hard drive and upload it to the server utilizing FileReference class -- they browse, select and upload. Everything works fine except I would like to give them an opportunity to listen to MP3 after they select the file but BEFORE they attempt uploading it. Of course I could just let them upload the thing and then stream it back but I don't like an easy life.
Naturally, loadSound("blah.mp3") doesn't work because I cannot know path to their file (or can I?). In any case I could not find a way to get the path to the selected file, which is fair from the security standpoint.
I hoped that the file accessed through FileReference would be somehow translated as an object into datatype SOUND (FileReference obviously knows that it deals with MP3 – not the MIME though – and it would be nice to write my_sound:Sound = new Sound(); my_sound = my_selected_file; and get over with the issue) -- in which case I would just start playing it. My high expectations did not come true. I guess the shortest rendition of my question is: Is there any way to convert selected MP3 into sound object, which I can manipulate?
I hope I am clear...
Thank you very much!
View Replies !
View Related
MP3 And FileReference
Hello!
I am having either thought constipation or lack of knowledge or both. Or maybe I want too much.
My application allows user to select an MP3 file from his hard drive and upload it to the server utilizing FileReference class -- they browse, select and upload. Everything works fine except I would like to give them an opportunity to listen to MP3 after they select the file but BEFORE they attempt uploading it. Of course I could just let them upload the thing and then stream it back but I don't like an easy life.
Naturally, loadSound("blah.mp3") doesn't work because I cannot know path to their file (or can I?). In any case I could not find a way to get the path to the selected file, which is fair from the security standpoint.
I hoped that the file accessed through FileReference would be somehow translated as an object into datatype SOUND (FileReference obviously knows that it deals with MP3 – not the MIME though – and it would be nice to write my_sound:Sound = new Sound(); my_sound = my_selected_file; and get over with the issue) -- in which case I would just start playing it. My high expectations did not come true. I guess the shortest rendition of my question is: Is there any way to convert selected MP3 into sound object, which I can manipulate?
I hope I am clear...
Thank you very much!
View Replies !
View Related
FileReference
Hey Guys,
For an desktop application I need to select an image on a Harddisk and show it in Flash. This should be done without the use of php or java cause the computers wich run this program will only be able to open the flash-exe, and can't be connected to internet.
The new reference object makes it possible to select a file but all I can read now is the filename, and what I need is the full location on the harddisk.
Is there a way to read out the full location from this image, or is there another way that works besides the new reference object?
Flash used is flash 8
Actionscript 2
Flash player 8
If anyone can help me, or at least tell me if this is possible of not, than please.
Thanx a lot.
Greeting
Ronnie Aerts
View Replies !
View Related
FileReference
hi all
i've a problem when using FileReference
this class give just file name , type , ... , but i want file in local disk address and name in one string
for example :
var my_address :String;
my_address=file.address+"/"+file.name;
thanks a lot
View Replies !
View Related
FileReference
Is there any way to get the file path of an object that is selected through the browse() method in the FileReference class. I don't think it can be done with a FileReference object, but is there another class that allows this, or any possible way to do this using XML? Thank you.
View Replies !
View Related
FileReference
Im uploading with the fileReference and want to check the mime type for security reasons.
The php code work in a regular html/php form but the same code doesnt work with the swf file, when I comment out the mime checking code it also works i flash.
Anybody know why this happens?
PHP Code:
$fil = $_FILES['Filedata']['name'];if (preg_match("/.(?:txt|doc|pdf)$/i", $fil)){ $mime = $_FILES['Filedata']['type']; //this doesnt work from flash! $mime = $_FILES['Filedata']['type']; if($mime == "application/msword" || $mime == "text/plain" || $mime == "application/pdf") { move_uploaded_file($_FILES['Filedata']['tmp_name'], "./files/".$_FILES['Filedata']['name']); }}
View Replies !
View Related
FileReference, What Else Is There
Hi.
I'm working with uploads and downloads via flash using FileReference class. Uploading file works wonderfull, but how I get the remote directory listing so the user may chose some file to download?
I was thinking about using php to get the file list of a remote directory (folder)...
How do you skilled AS2 programmers do to make some file explorer in flash (or finder...)?
Thanks!
View Replies !
View Related
XML And FileReference
I know that you're not supposed to be able to write files to server, etc, etc without AIR, but I know that FileReference does get, well a file handle. Is there ANY known way to modify an existing XML file in the same directory as the SWF on the local system, whether using FileReference or not?
View Replies !
View Related
FileReference Help
Hey, anyone familiar with using AS3 to download a file from a server to a clients computer? I know how to program it, just getting unexpected results.
Im using....
Code:
var fileReference:FileReference = new FileReference();
var urlRequest:URLRequest = new URLRequest("icmlogo.eps");
try {
fileReference.download(urlRequest);
}
catch (error:Error){
trace("error")
}
}
Whats happening is when I click the file to be downloaded, it prompts me to save the file, but when I hit save, the file is not downloaded. Any advice???
Thanks Alot for any help.
If any one has another method for allowing user to download file, please let me know!
View Replies !
View Related
FileReference
Hi,
I've found this description of the FileReference class and how to use it in Adobe's support section:
http://kb.adobe.com/selfservice/viewCon ... &sliceId=1
but it's not working for me. The database guys assure me their Java servlet uses the same methods as the example given by Adobe (http://servlets.com/cos/).
I can upload a file to them through an html form. And I can upload a file to a php script from my app. But when we try to put the two together, something hits his box, then stalls, indefinitely.
Has anyone run into this problem? I don't think it's a network problem, as we've got other request going back and forth fine.... I'm stumped.
Any ideas?
thanks
View Replies !
View Related
Filereference Directory
Hi. When selecting a file for upload (browsing) using FileReference, if I use FileReference.name, it only shows the name of the selected file. Is there a way to get the absolute path of the selected file? Please help.
View Replies !
View Related
FileReference Madness
Hi all,
I've been trying to get a simple FileReference example to work for the last few hours without any luck.
Here's the ActionScript:
PHP Code:
import flash.net.FileReference;
var listener:Object = new Object();
listener.onSelect = function(selectedFile:FileReference):Void {
selectedFile.upload("http://www.mackstudiopro.com/simpleUpload.php");
}
var imageFile:FileReference = new FileReference();
imageFile.addListener(listener);
uploadButton.addEventListener("click", uploadImage);
function uploadImage(event:Object):Void {
imageFile.browse();
}
And here is the PHP script:
PHP Code:
<?php
move_uploaded_file($_FILES['Filedata']['tmp_name'], "./images/".$_FILES['Filedata']['name']);
?>
As you can see, it's watered down to the bare minimum; on the root of my server I placed all of the following:
- a cross-domain security policy
- the swf file
- the html file
- the PHP file
- a new directory called "images" with permissions set to read and write
The only thing I was expecting to see were files being added to the images folder as they were uploaded; instead nothing appears to be happening.
My server supports PHP 4.3.1 and I am authoring on a Mac.
Also, when I add the onHTTPError event to the listener I get a "HTTPError number: 500 File: undefined" error when I try to visit the page live.
Any help greatly appreciated.
View Replies !
View Related
Simple Filereference()
Alright guys,
This is a pretty simple one for someone out there! Basically I have been looking through filereference() tutorials/samples, and they are far too complex!
All i want is to click on a movieclip which obviously will have a onRelease state attached and then a download box open to save the file to disk.
I don't want complex preloaders!
I don't want complex filelist boxes!
Any help guys?
Thanks.
View Replies !
View Related
Flash.net.FileReference
Hey! I'm not sure if flash.net.FileReference is available in MX or if it just a Flash 8 thing but when I try to run execute the following code on a button
Code:
import flash.net.FileReference;
on(release){
var myMP3 = "url to mp3";
var fileRef:FileReference = new FileReference();
function bringmetheMP3(){
fileRef.download(myMP3, 'Queen.mp3')
}
}
I get the error:
Code:
Symbol=mc_main_sp, Layer=Layer 9, Frame=3: Line 1: ';' expected
import flash.net.FileReference;
Is my syntax wrong or how can I get this bit of code to work? I'm trying to accomplish this: http://www.blog.lessrain.com/?p=205
Thanks!
Sly
View Replies !
View Related
FileReference Problems
The problem is I can't seem to get at the uploaded file once done. I've read the Flash help like 6 times and still nothing explains the main dled file.
this is basically the help example from flash.
import flash.net.FileReference;
var Level_doc = a;
this.onPress = function() {
var listener:Object = new Object();
listener.onSelect = function(file:FileReference):Void {
trace("Opened "+file.name);
};
listener.onCancel = function(file:FileReference):Void {
trace("User cancelled");
};
listener.onProgress = function(file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {
trace("onProgress with bytesLoaded: "+bytesLoaded+" bytesTotal: "+bytesTotal);
};
listener.onOpen = function(file:FileReference):Void {
trace("onOpen: "+file.name);
};
var fileRef:FileReference = new FileReference();
fileRef.addListener(listener);
fileRef.browse([{description:"Text (*.txt)", extension:"*.txt;"}]);
_parent._parent.play();
};
Can anyone help tell me which to use to get at the text file I just loaded onPress? Furthermore, it keeps saying it's going to upload files, but the prompt gives askes me what to open infering a download. I'm confused.
Thanks for the help
View Replies !
View Related
Another 'FileReference' Question..
here is the code I have pieced together from random threads....
Code:
upload_btn.onPress = function() {
selectedFile.upload("http://www.dmstudios.net/upLoad_test/saveFile.php");
trace("Upload Clicked");
upload_txt.text = "Upload Button Clicked";
}
browse_btn.onPress = function() {
System.security.allowDomain(script.split("/").slice(0,3).join("/")); //whats the security do?
import flash.net.FileReference;
//create a new object to handle the fileUpload data options/returns
fileUpload = new Object();
fileUpload.onSelect = function(selectedFile:FileReference):Void {
trace("onSelect (File Choice): " + selectedFile.name);
browse_txt.text += selectedFile.name;
}
fileUpload.onCancel = function(selectedFile:FileReference):Void {
trace(newline+"onCancel (Cancelled)");
upload_txt.text += newline+"(Cancelled)";
}
fileUpload.onOpen = function(selectedFile:FileReference):Void {
trace(newline+"onOpen: (File Opened) " + selectedFile.name);
upload_txt.text += newline+"onOpen: (File Opened) " + selectedFile.name;
}
fileUpload.onProgress = function(selectedFile:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {
trace(newline+"Progress: "+newline+"bytesLoaded: " + bytesLoaded +newline+"bytesTotal: " + bytesTotal);
upload_txt.text = newline+"Progress: "+newline+"bytesLoaded: " + bytesLoaded +newline+"bytesTotal: " + bytesTotal;
}
fileUpload.onComplete = function(selectedFile:FileReference):Void {
trace(newline+"onComplete: (Done) " + selectedFile.name);
upload_txt.text += newline+"(Done)";
}
fileUpload.onIOError = function(selectedFile:FileReference):Void {
trace(newline+"onIOError: " + selectedFile.name);
upload_txt.text += newline+"onIOError: " + selectedFile.name;
}
//fileReference Object
selectedFile = new FileReference();
selectedFile.addListener(fileUpload);
selectedFile.browse();
}
I have that on frame 1 in the main time line... 2 buttons...2 dynamic textFields. (nothing more)
when I run this locally...traces & textFields reflect the name selected...when the upload button is clicked...it also (locally) shows the totalBytes/loadedBytes .. nothing more.
output:
Code:
Upload Button Clicked
onOpen: (File Opened) PI_logo.jpg
Progress:
bytesLoaded: 0
bytesTotal: 50234
Progress:
bytesLoaded: 32768
bytesTotal: 50234
Progress:
bytesLoaded: 50234
bytesTotal: 50234
on-line..I only get this:
Code:
Upload Button Clicked
I do NOT get the DONE trigger..and of course..no files are uploaded.
both the directory and the .php file itself have full chmod permissions..
here is the php script Im using:
PHP Code:
<?php
copy($_FILES['Filedata']['tmp_name'],$_FILES['Filedata']['name']);
?>
this is completely new to me... I undertsnad the AS more or less...but the PHP is foreign..
appreciate any help ..thanks
update: I traced the httpError: number...and its 500.
Code:
500 Internal Server Error
The server encountered an unexpected condition which prevented it
from fulfilling the request.
following up here:
ftp://ftp.isi.edu/in-notes/rfc2616.txt (chapters 100.4-10.5)
it says:
(brief overview of all 5XX errors)
Code:
10.5 Server Error 5xx
Response status codes beginning with the digit "5" indicate cases in
which the server is aware that it has erred or is incapable of
performing the request. Except when responding to a HEAD request, the
server SHOULD include an entity containing an explanation of the
error situation, and whether it is a temporary or permanent
condition. User agents SHOULD display any included entity to the
user. These response codes are applicable to any request method.
what gives??
View Replies !
View Related
FileReference Uploading Flv
Hi,
I would like to upload .flv files. Image files and text files are being uploaded without a problem, but flv files aren't.
Code:
import flash.net.FileReference;
var allTypes:Array = new Array ();
var imageTypes:Object = new Object ();
imageTypes.description = "Image (*.JPG;*.JPEG;*.JPE;*.GIF;*.PNG;)";
imageTypes.extension = "*.jpg; *.jpeg; *.jpe; *.gif; *.png;";
allTypes.push (imageTypes);
var textTypes:Object = new Object ();
textTypes.description = "Text Files (*.txt, *.rtf)";
textTypes.extension = "*.txt;*.rtf";
allTypes.push (textTypes);
var videoTypes:Object = new Object ();
videoTypes.description = "Flash Video (*.flv;*FLV;)";
videoTypes.extension = "*.flv";
allTypes.push (videoTypes);
var listener:Object = new Object ();
listener.onSelect = function (file:FileReference):Void {
tStatus.text += "onSelect: " + file.name;
trace ("type: " + file.type);
};
listener.onCancel = function (file:FileReference):Void {
tStatus.text += "onCancel";
};
listener.onOpen = function (file:FileReference):Void {
tStatus.text += "onOpen: " + file.name;
};
listener.onProgress = function (file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {
tStatus.text += "onProgress with bytesLoaded: " + bytesLoaded + " bytesTotal: " + bytesTotal;
};
listener.onComplete = function (file:FileReference):Void {
tStatus.text += "onComplete: " + file.name;
};
listener.onHTTPError = function (file:FileReference):Void {
tStatus.text += "onHTTPError: " + file.name;
};
listener.onIOError = function (file:FileReference):Void {
tStatus.text += "onIOError: " + file.name;
};
listener.onSecurityError = function (file:FileReference, errorString:String):Void {
tStatus.text += "onSecurityError: " + file.name + " errorString: " + errorString;
};
var fileRef:FileReference = new FileReference ();
fileRef.addListener (listener);
mcBrowse.onPress = function () {
fileRef.browse (allTypes);
};
mcUpload.onPress = function () {
fileRef.upload ("upload.php");
};
php:
PHP Code:
<?php
//path to storage
$storage = 'uploads';
//path name of file for storage
$uploadfile = "$storage/" . basename( $_FILES['Filedata']['name'] );
//if the file is moved successfully
if ( move_uploaded_file( $_FILES['Filedata']['tmp_name'] , $uploadfile ) ) {
echo( '1 ' . $_FILES['Filedata']['name']);
//file failed to move
}else{
echo( '0');
}
?>
Thank you,
Jerryj.
View Replies !
View Related
[f8][AS2] FileReference & XML Reference
Hi,
Well thanks to this forum, I now have a downloadable link but I need to reference the XML document to ensure viewers are downloading the movie they are watching.
The FileReference works just fine but the code I have highlighted between the bars is what I have changed and it doesn't work, I've obviously referenced the XML Document incorrectly, all I get is "undefined.wmv" - Anybody got any ideas?
BTW: Xml document below the code
Cheers
Tigger7
PHP Code:
stop();System.useCodepage = true;var easing = true;var auto = false;var mouseWheel = true;var mouseCoord = false;var barVisual = true;var space = 4;var path = "2005.xml";contentMain4.createEmptyMovieClip("back_mc", this.getNextHighestDepth());contentMain4.setMask(maskedView);var myxml = new XML();myxml.ignoreWhite = true;myxml.onLoad = function(success) { var item = this.firstChild.childNodes; trace(this.firstChild.firstChild.attributes.videotitle); trace(this.firstChild.firstChild.attributes.url); if (success) { for (var i:Number = 0; i<item.length; i++) { var temp_mc = contentMain4.attachMovie("item", "item"+i, i); temp_mc._y += i*(temp_mc._height+space); contentMain4.back_mc._height = i*(temp_mc._height+space); temp_mc.tname = item[i].attributes.name; temp_mc.tlink = item[i].attributes.link; temp_mc.videotitle =item[i].attributes.videotitle; temp_mc.url = item[i].attributes.url; temp_mc.thumb = item[i].firstChild.firstChild.nodeValue; temp_mc.item_txt.text = temp_mc.tname; temp_mc.item_thumb.loadMovie(temp_mc.thumb); contentHolder_mc.contentinfo.htmlText = item[0].childNodes[1].firstChild.nodeValue; temp_mc.onRelease = function() { vtitle_txt.htmlText = "<a href='"+this.url+"'>"+this.videotitle+"</a>"; playBut.onRelease(); videoDisplay.setMedia(this.tlink,"FLV"); }; } vtitle_txt.htmlText = true; vtitle_txt.htmlText = "<a href='"+this.firstChild.firstChild.attributes.url+"'>"+this.firstChild.firstChild.attributes.videotitle+"</a>"; videoDisplay.setMedia(this.firstChild.firstChild.attributes.link,"FLV"); scrolling(easing, auto, mouseWheel, mouseCoord, barVisual);download_button.onRelease = function(){import flash.net.FileReference;var listener:Object = new Object();listener.onSelect = function(file:FileReference):Void { txt.text = "onSelect: "+file.name;};listener.onCancel = function(file:FileReference):Void { txt.text = "Download was cancelled";};listener.onOpen = function(file:FileReference):Void { txt.text = "onOpen: "+file.name;};listener.onProgress = function(file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void { trace ("onProgress with bytesLoaded: " + bytesLoaded + " bytesTotal: " + bytesTotal);//this is now in the scope of the object, so we reference its parent property we create to get back to the scope of the ProgressBar this.parent.down_pb.setProgress (bytesLoaded, bytesTotal);};listener.onComplete = function(file:FileReference):Void { txt.text = "File has downloaded";};listener.onIOError = function(file:FileReference):Void { trace("Error with download");};var fileRef:FileReference = new FileReference();fileRef.addListener(listener);//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++var url:String = this.url;if (!fileRef.download(url,"<a href='"+this.firstChild.firstChild.attributes.videotitle+"'>"+".wmv</a>")){ trace("dialog box failed to open.");}}//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ } else { trace("error"); }};myxml.load(path);function scrolling(easing, auto, mouse) { var moveSpeed = 1; var easingSpeed = 10; var scrollHeight = scrollbg4._height; var scrollable = contentMain4._height-maskedView._height+2; var top_scroll = contentMain4._y; var left = scrollbg4._x-2; var top = scrollbg4._y; var right = scrollbg4._x-2; var bottom = scrollbg4._y+scrollbg4._height-dragger4._height; if (scrollable<0) { dragger4._visible = false; btnup4._alpha = 0; btndown4._alpha = 0; scrollbg4._alpha = 0; btnup4.enabled = false; btndown4.enabled = false; return; } function updateContentPos() { var percent_scrolled = (dragger4._y-btnup4._y-btnup4._height)/(scrollHeight-dragger4._height); contentMain4.newY = Math.round(top_scroll-(scrollable*percent_scrolled)); trace(contentMain4.newY); } contentMain4.onEnterFrame = function() { if (!easing || easing == undefined) { this._y = this.newY; } else { this._y += (this.newY-this._y)/easingSpeed; } }; dragger4.onPress = function() { startDrag(this, false, left, top, right, bottom); this.onMouseMove = function() { updateContentPos(); }; }; dragger4.onRelease = dragger4.onReleaseOutside=function () { stopDrag(); delete this.onEnterFrame; }; btnup4.onPress = function() { this.onEnterFrame = function() { dragger4._y = Math.max(top, dragger4._y-moveSpeed); updateContentPos(); }; }; btnup4.onRelease = function() { delete this.onEnterFrame; }; btndown4.onPress = function() { this.onEnterFrame = function() { dragger4._y = Math.min(bottom, dragger4._y+moveSpeed); updateContentPos(); }; }; btndown4.onRelease = function() { delete this.onEnterFrame; }; updateContentPos();}
PHP Code:
<?xml version="1.0" encoding="utf-8"?><item><list name="Me Driving a Westfield" videotitle="WSCC Curborough 2007" link="video/154_t3.flv" url="952.wmv"><thumb>thumb/952.jpg</thumb></list></item>
View Replies !
View Related
Filereference Error
i am working with the FileReference class. Do i HAVE to use an absolute url for downloading a file? For example....in my code, i have the following:
Code:
var dl=this.block_download.getChildByName("download_button");
dl.addEventListener(MouseEvent.CLICK,onclickhandler);
}
private function onclickhandler(e:MouseEvent):void
{
var ur:URLRequest= new URLRequest();
ur.url="docs/pdf/thisdoc.pdf";
fr= new FileReference();fr.addEventListener(HTTPStatusEvent.HTTP_STATUS,h_status);
fr.addEventListener(IOErrorEvent.IO_ERROR,io_status);
fr.download(ur,"test.pdf)
}
but i get an error: Error: Error #2039: Invalid remote URL protocol. The remote URL protocol must be HTTP or HTTPS. The error event and status event are handled later in the class
This leaves me with the impression i can not reference a relative path in my movie? or do i have this wrong?
View Replies !
View Related
IE7 / 9,0,124 / FileReference BUG Still No Answer...
New thread b/c I THOUGHT I had resolved the old one by adding this to the crossdomain.xml file:
<allow-http-request-headers-from domain="*" headers="*"/>
The bottom line is I'm having FileReference.upload() from a www subdomain to the primary domain failing on some Vista boxes. I cannot replicate the error, and have had reports of other Vista boxes working fine (not sure what version of flash they're running). Safari is okay. Firefox is unknown b/c firefox fails on fileref uploads over ssh (always tacks on port 80, a known bug in ff)...
Any help in this would be greatly appreciated!
Josh
View Replies !
View Related
FileReference() Issue
i am having problems as well. here's a link to my AS: http://actionscript.pastebin.com/708461 and this is a link to the player http://www.jeremylister.com/flashGallery it doesn't seem to get past the downloadListerner.onSelect() on line 36. everything works flawlessly when run locally, but it hangs when online. any thoughts?? i'm beating my head against the wall. thanks in advance.
-senatorslab
View Replies !
View Related
FileReference And ASP Script
Hello All ---
I am looking for an ASP script to work in tandem with the FileReference class. I have searched the web but can only find mostly PHP scripts. My server has ASPUpload and SA FileUp available but am not having much luck getting the file to upload to the server. Can anyone assist in getting me on the right path?
Thanks.
View Replies !
View Related
FileReference Download
Hi,
Gotta an issue with my class I am trying to create, root of the problem is the FileReference download! Basically can anyone suggest why I am not getting an OS window to open here, basically success == false all the damn time? The _trackUrl and _trackName are being passed from the TracksXmlLoader class...
Any ideas? Cheers Si
Code:
// imports
import flash.net.FileReference;
import mx.utils.Delegate;
// create class
class Test extends TracksXmlLoader {
// class variables
private var _fileReference:FileReference;
private var addListener:Function;
// class constructor
public function Test (url:String) {
super (url);
//create a new FileReference object with the instance name '_fileReference'
this._fileReference = new FileReference ();
//add 'this' as a listener to '_fileReference'
this._fileReference.addListener (this);
setUp ();
}
public function optionDownload ():Void {
// create reference to the _trackName & _trackURL because I cannot workout
// how to reference them in this class by any other means???
var _trackName:String = _trackName;
var _trackURL:String = _trackURL;
super.optionDownload ();
}
private function setUp ():Void {
this.setupStart ();
}
//invoked by 'setUp()'
private function setupStart ():Void {
_root.download_btn.onPress = Delegate.create (this, this.openDownloadDialog);
}
private function openDownloadDialog ():Void {
var success:Boolean;
//open OS window and specify the path to the file to download and the file name that will be displayed
success = this._fileReference.download (_trackURL, _trackName+'.mp3');
//if the OS window failed to open
if (success == false) {
_root.download_btn.download_info.text = "OS window failed to open";
}
}
}
View Replies !
View Related
FileReference Upload
First post, a question about FileReference.
I use FileReference to upload an image file with PHP script.
The php script moves uploaded file to a folder and name it with its tmp_name. It works fine.
Here's the problem :
I want to return its tmp_name as a variable back to flash when onComplete is called.
I tried Print "tmpName=".basename($_FILES['Filedata']['tmp_name'])
View Replies !
View Related
FileReference FLV Issue
Hello,
I have a fileReference function that uploads files.
I can successfully upload images and mp3 files. Once uploaded the photos are displayed or the music plays
However, when I upload FLV files they become corrupt and won't play. I tested this by FTPing the same flv file and it loading it into my movie without a problem.
So the issue seems to be with the file reference upload. Somehow it corrupts the file.
I've tried many different flvs to test.
Anyone hear of or experience this issue?
Thx
View Replies !
View Related
Problem With Filereference
hi, i am trying to create a downloadable album using the filereference class
after a while of experimenting i have finally managed to get the files to be uploaded...
every file thats being downloaded has its progress bar embeded in the dowload btn movie clip, and is called by the filereference class onProgress event.
the problem is that once you press on a different file to be dowloaded, the progress is shown on the other bar, rather than opening a new one...
you can take a look and see what i mean...
(songs 1-5 are downloadable)
here is the link to the site...
http://omrihecht.com/temp/nirAlbum/albumenglish.html
the script that runs it is :
_root["songName_mc"+num].dnld_btn.onRelease = function() {
songNum = num;
var fileRef:FileReference = new FileReference(this);
fileRef.addListener(fileDownloadListener);
var url:String = "http://omrihecht.com/temp/nirAlbum/"+theURL;
//trace('"'+theURL+'"');
if (!fileRef.download(url)) {
trace("dialog box failed to open.");
}
};
fileDownloadListener.onProgress = function(file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {
_root["songName_mc"+songNum].onEnterFrame = function() {
if (bytesLoaded<bytesTotal) {
this.loadProgressBar._visible = true;
if (this.loadProgressBar._alpha<100) {
this.loadProgressBar._alpha += 10;
}
var loadPercent:Number = (bytesLoaded/bytesTotal)*100;
this.loadProgressBar.loadProgressColor._xscale = loadPercent;
} else {
//trace("complete");
if (this.loadProgressBar._alpha>0) {
this.loadProgressBar._alpha -= 10;
} else {
delete this.onEnterFrame;
}
}
};
};
View Replies !
View Related
FileReference Same Name Error.
I've created an uploader flash file using fileReference.
It goes to the php where it's uploaded to my server with move_uploaded_files
I created an IF statement in that php file to check and see if there is a file with the same name already on the server. If so, echo an error.
What I'm trying to find out is if there is a way to do this in the Actionscript for this type of error?
Code:
listener.onNameError = function (file){ //If the file name already exists....
_root.nameerrormc.gotoAndPlay("go"); // Play the error message movie clip.
}
View Replies !
View Related
Filereference Question
Hi All,
I've got a bit of a problem which I can't solve. I'm not sure if Flash is my problem but here it goes:
I've created 2 flash movies. The first movie only contains a browse button for locating the file that is supposed to be uploaded. Once selected a second flash movie is started for showing the upload progress. Everything is just fine and upload goes through.
However not everybody can do the upload, it shows the progress but when the upload is finished some people get an error?
Could this be caused by the sandbox (i've read about) and that the upload should come from the same domain?
However if someone goes to my upload page then both flash movies run on the same page (the second movie is started in a popover). I've gone through all my php code and couldn't find anything wrong. The only thing I can think of is that I need to rebuild my flash movies to use cross domain scripting? Can this be the problem?
Thanks for any help..
View Replies !
View Related
FileReference Uploading
Hello!
I have followed a great tutorial for uploading files using the fileReference class... and there was mention of a PHP script to follow... which as of yet never came...
Does anyone have it or know how to handle the file once uploaded?
I came across this yamzbrowser thing as well... but couldn't find any documentation on how to implement it.
Is the yamzbrowser a better option?
HIAP
View Replies !
View Related
FileReference Uploading Flv
Hi,
I would like to upload .flv files. Image files and text files are being uploaded without a problem, but flv files aren't.
Code:
import flash.net.FileReference;
var allTypes:Array = new Array ();
var imageTypes:Object = new Object ();
imageTypes.description = "Image (*.JPG;*.JPEG;*.JPE;*.GIF;*.PNG;)";
imageTypes.extension = "*.jpg; *.jpeg; *.jpe; *.gif; *.png;";
allTypes.push (imageTypes);
var textTypes:Object = new Object ();
textTypes.description = "Text Files (*.txt, *.rtf)";
textTypes.extension = "*.txt;*.rtf";
allTypes.push (textTypes);
var videoTypes:Object = new Object ();
videoTypes.description = "Flash Video (*.flv;*FLV;)";
videoTypes.extension = "*.flv";
allTypes.push (videoTypes);
var listener:Object = new Object ();
listener.onSelect = function (file:FileReference):Void {
tStatus.text += "onSelect: " + file.name;
trace ("type: " + file.type);
};
listener.onCancel = function (file:FileReference):Void {
tStatus.text += "onCancel";
};
listener.onOpen = function (file:FileReference):Void {
tStatus.text += "onOpen: " + file.name;
};
listener.onProgress = function (file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {
tStatus.text += "onProgress with bytesLoaded: " + bytesLoaded + " bytesTotal: " + bytesTotal;
};
listener.onComplete = function (file:FileReference):Void {
tStatus.text += "onComplete: " + file.name;
};
listener.onHTTPError = function (file:FileReference):Void {
tStatus.text += "onHTTPError: " + file.name;
};
listener.onIOError = function (file:FileReference):Void {
tStatus.text += "onIOError: " + file.name;
};
listener.onSecurityError = function (file:FileReference, errorString:String):Void {
tStatus.text += "onSecurityError: " + file.name + " errorString: " + errorString;
};
var fileRef:FileReference = new FileReference ();
fileRef.addListener (listener);
mcBrowse.onPress = function () {
fileRef.browse (allTypes);
};
mcUpload.onPress = function () {
fileRef.upload ("upload.php");
};
php:
PHP Code:
<?php
//path to storage
$storage = 'uploads';
//path name of file for storage
$uploadfile = "$storage/" . basename( $_FILES['Filedata']['name'] );
//if the file is moved successfully
if ( move_uploaded_file( $_FILES['Filedata']['tmp_name'] , $uploadfile ) ) {
echo( '1 ' . $_FILES['Filedata']['name']);
//file failed to move
}else{
echo( '0');
}
?>
Thank you,
Jerryj.
View Replies !
View Related
FileReference Vs. LoadVars
ok, so i built a (multipart/form-data) form in php that has one upload field for an image, and a few text input fields (email, age, etc)
now i used the FileReference class to upload an image from Flash to the php file and surprisingly, this worked without a hitch!
but i also would like to submit (POST) some other flash input text fields to the same page that the FileReference object calls... at the same time.
basically i want to append a few more form data fields to the one that the FileReference object submits. since it works.
because the php file creates a new record from this submitted form, then accepts, resizes, and renames the uploaded image file and records the new name of the file to a different table in the database along with the new record id (fk) from the previous table.
any suggestions on how i can emulate my php form in flash? with a single form and POST submission?
View Replies !
View Related
FileReference Equivalent?
Is there a way to mimic the FileReference class from Flash 8 in MX 2004? I suspect I will need to upgrade to do the following, but I'd love some input from you guys first.
Basically, the concept is to build my friend a site that she can update herself - with a password protected area, I want her to be able to upload images to her server, and for the Flash movie to detect these new images in a gallery (with thumbnails preferably). Also some kind of blog and gig diary functionality would be nice.
I suppose the upload section could quite easily be done outside of Flash if anyone has thoughts on that?
View Replies !
View Related
Uploading Using PHP And FileReference
Ok, so i've seen the tutorials, done EXACTLY everything they said, and used 3 or 4 different php scripts to get this uploading going. To No Avail. I am starting to believe that there's a server side permissions problem with either the temp folder or something like that. I fully understand what's going on but i'm definately stuck. The actionscript is as follows:
System.security.allowDomain("http://localhost/");
import flash.net.FileReference;
stop();
var acceptedTypes:Array = new Array();
var fileTypes:Object = new Object();
fileTypes.description = "Documents (*.doc, *.pdf)";
fileTypes.extension = "*.doc; *.pdf";
acceptedTypes.push(fileTypes);
//For uploading
var listener:Object = new Object();
listener.onSelect = function(selectedFile:FileReference):Void
{
trace("Attempting to upload " + selectedFile.name);
// Upload the file to the PHP script on the server.
selectedFile.upload("upload.php");
};
listener.onComplete = function(selectedFile:FileReference):Void
{
trace("upload complete");
};
listener.onProgress = function(selectedFile:FileReference, uploadedBytes:Number):Void
{
trace(uploadedBytes.toString());
};
listener.onIOError = function(selectedFile:FileReference):Void
{
trace("IO error on file : " + selectedFile.name);
};
listener.onHTTPError = function(selectedFile:FileReference ):Void
{
trace("http error");
};
listener.onSecurityError = function(selectedFile:FileReference):Void
{
trace("security error");
};
function upload()
{
var userSubmission:FileReference = new FileReference();
userSubmission.addListener(listener);
userSubmission.browse(acceptedTypes); //Works Fine
}
upload_btn.addEventListener("click", upload);
As for the PHP script, as I mentioned I used several different one all with the same basic funcitonality. Here's the one I'm currently using
<?php
//create the directory if doesn't exists (should have write permissons)
if(!is_dir("./files"))
{
mkdir("./files", 0755);
}
//move the uploaded file
move_uploaded_file($_FILES['Filedata']['tmp_name'], "./files/".$_FILES['Filedata']['name']);
chmod("./files/".$_FILES['Filedata']['name'], 0777);
?>
Also, I have several other Flash-PHP things going and they're working fine
HELP PLEASE
View Replies !
View Related
Filereference For Download
Hello
When I use this code to download a pdf
Code:
private function downloadPDF(event:Event):void{
fileRef.download(new URLRequest("pdf/rusland.pdf"), "rusland.pdf");
}
I only download this Flashtmp0.tmp file
The path is correct, does anyone know what the problem could be?
View Replies !
View Related
What Am I Doing Wrong With The FileReference?
I'm trying to get the FileReference object working and it doesn't seem to want to send SELECT or CANCEL events.
The code below opens the browse dialog box. But it don't get the SELECT or CANCEL when I close the box. What am I doing wrong?
ActionScript Code:
package {
import flash.display.MovieClip;
import flash.events.*;
import flash.net.*;
public class Main extends MovieClip {
public function Main() {
var f:FileReference = new FileReference();
var imagesFilter:FileFilter = new FileFilter( "Images", "*.jpg;*.gif;*.png" );
f.addEventListener( Event.SELECT, on_select );
f.addEventListener( Event.CANCEL, on_cancel );
f.browse( [ imagesFilter ] );
}
private function on_select( e:Event ):void {
trace( "Select:" );
}
private function on_cancel( e:Event ):void {
trace( "Cancel" );
}
}
}
View Replies !
View Related
FileReference & JPG Encoding
Hey,
I'd like to know if this is possible. I need to select an image file from the user's system, JPG encode it and send it to a server as a ByteArray. The encoding itself works, but I am having a hard time accessing the file itself. I have been trying to load the image into the Flash movie, but this only seems to work if I am running the movie locally and the file is located in the same directory as the Flash movie. Otherwise I can only get the file name without the full path. So, is there a way to encode the image using only the FileReference, without having to load the image into the Flash movie first? This might be the only way to do this since using PHP is out of the question.
Thanks!
View Replies !
View Related
Problem With FileReference
first, sorry for my bad english
I want to upload a File over the Filereference.
my problem is that the Java servlet get no parameter from AS.
The Fileupload are ok but i need to rename the File one parameter from AS but it is null.
AS3 Code
ActionScript Code:
var arguments:URLVariables = new URLVariables();
arguments.newName = "testName";
var request:URLRequest = new URLRequest("http://localhost:8080/FlexBoard/servlet/Upload");
request.data = arguments;
this.fileRef.upload(request);
Java Servlet Code
ActionScript Code:
protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException
{
String newName = req.getParameter("newName");
try
{
String path = Helper.getPropertyValue("uploadpath");
String extension = Helper.getPropertyValue("uploadextension");
MultipartRequest part = new MultipartRequest(req,path,1024*1024*40 ,new FileRename(path+newName+extension));
}
catch(Exception ex)
{
System.out.println("Fehler
" + ex.getMessage());
}
}
If i use the URLLoader, the servlet gets the parameter but i can't upload
Thanks
View Replies !
View Related
FileReference W/ Relative URL
I'm using fileReference on a button to download a file. It works fine if I hard code the entire url for the download file.
However, I'm testing on my site; then the folder structure for the site will be moved to the clients server (which I don't have access to). Thus, I need a way to use relative paths and it doesn't seem to work unless the entire path is encoded.
Here's the code:
ActionScript Code:
on (release) {
import flash.net.FileReference;
var file= new FileReference();
file.download("/ppt/aerodata.pps", "aerodata.pps");}
This doesn't work, but if I change the last line to:
ActionScript Code:
file.download("http://www.spontaneouspop.com/projects/ifis/ppt/aerodata.pps", "aerodata.pps");}
it works!
The swf file resides at "http://www.spontaneouspop.com/projects/ifis/ifis01.swf"
so it seems like a relative url would work.
Any help would be greatly appreciated!!!!
View Replies !
View Related
|