Upload Binary Data From Flash
We ran up against a problem that I was hoping someone could help with. I’ll try to spare whatever details are not needed.
Basically, I want to upload an image that has been loaded into Flash to a server. I can download from a server to the movie with a simple LoadMovie. However, sending it back has me perplexed.
I know about the FileReference class in Flash 8, but it seems to only work for uploading actual images on a user’s hard drive that they select.
Let’s assume that instead we have a JPEG in our movie and we want to send it back to the server for whatever reason. I’m aware that we can loop though each pixel and convert it to a string, and send that string. Unfortunately, that doesn’t work out for us in our unique situation. We really need a binary method of transmitting it.
Does anyone know if this is possible? If not in Flash 8, can it be done in Flash 9/Flex?
Any help would be greatly appreciated!
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 10-18-2006, 03:53 PM
View Complete Forum Thread with Replies
Sponsored Links:
Upload Binary Data From Flash
We ran up against a problem that I was hoping someone could help with. I’ll try to spare whatever details are not needed.
Basically, I want to upload an image that has been loaded into Flash to a server. I can download from a server to the movie with a simple LoadMovie. However, sending it back has me perplexed.
I know about the FileReference class in Flash 8, but it seems to only work for uploading actual images on a user’s hard drive that they select.
Let’s assume that instead we have a JPEG in our movie and we want to send it back to the server for whatever reason. I’m aware that we can loop though each pixel and convert it to a string, and send that string. Unfortunately, that doesn’t work out for us in our unique situation. We really need a binary method of transmitting it.
Does anyone know if this is possible? If not in Flash 8, can it be done in Flash 9/Flex?
Any help would be greatly appreciated!
View Replies !
View Related
Uploading Binary Data From Flash
We ran up against a problem that I was hoping someone could help with. I’ll try to spare whatever details are not needed.
Basically, I want to upload an image that has been loaded into Flash to a server. I can download from a server to the movie with a simple LoadMovie. However, sending it back has me perplexed.
I know about the FileReference class in Flash 8, but it seems to only work for uploading actual images on a user’s hard drive that they select.
Let’s assume that instead we have a JPEG in our movie and we want to send it back to the server for whatever reason. I’m aware that we can loop though each pixel and convert it to a string, and send that string. Unfortunately, that doesn’t work out for us in our unique situation. We really need a binary method of transmitting it.
Does anyone know if this is possible? If not in Flash 8, can it be done in Flash 9/Flex?
Any help would be greatly appreciated!
View Replies !
View Related
Binary Upload Progress
does anyone know how to track the progress of binary data upload using URLLoader?
ActionScript Code:
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.BINARY;
loader.addEventListener(Event.COMPLETE, itemUploadCompleteHandler);
loader.addEventListener(IOErrorEvent.IO_ERROR, itemUploadFailedHandler);
loader.addEventListener(ProgressEvent.PROGRESS, itemUploadProgressHandler);
loader.load(req);
the ProgressEvent.bytesLoaded in the progress handler has the value of 3,
and the ProgressEvent.bytesLoaded has the value of 0.
the upload itself works just fine, i need a way to track the progress.
any ideas?
thanks
View Replies !
View Related
Loading Binary Data Into Flash From An External File.
Does anyone know if it is possible to load binary data into flash from an external file, it has been sugested maybe using XML commands - like when you load a ROM into an emulator. It doesn't have to be whilst running though it could be when it is compiled however it would be nice to be parsed on the fly like a proper emulator!
Any help would be great so thanks in advance to anyone who helps.
Gary
View Replies !
View Related
Load A Binary Data File In Flash MX 2004?
I've been animating in Flash for about 9 months and am now looking at a more serious programming project in Flash MX 2004.
My question is - is there a way to load a binary file of arbitrary content into Flash? I know Flash recognizes certain types of media files, but I just want to access a URL with a raw binary bytestream and interpret the data directly. I looked at the Item class but didn't see an obvious way to do this.
Am I trying to push Flash in a direction it's not meant to go?
View Replies !
View Related
Uploading Binary Data From As3
I was trying a few methods to uplaod binary data (jpeg) that I create in the action script (it's not a file on the system but self created by the action script)
I hold the data in a ByteArray object.
I see that I have two basic options to send the data:
1.
myRequest:URLRequest;
imageData:ByteArray;
myRequest.data = imageData;
navigateToURL(myRequest,"self");
2.
myRequest:URLRequest;
imageData:ByteArray;
myURLVariables:URLVariables;
defining the variables
myRequest.data = myURLVariables;
navigateToURL(myRequest,"self");
the problem:
if I choose the first method, I can only send one file, and from some reason I cann't get to it in ruby on rails (because it's a raw http post data and not multipart-form)
If I choose the second way I think the file is not being sent (it's also not multipart-form, but tries to be url-encoded) I try to examine the http request-response and it seems like the data is not proper in those requests.
If anyone can help me on how to manually set the needed properties of this data shipment so it would reach it's finaly destination I would really appreciate it.
TIA
Neer
neerfri@gmail.com
View Replies !
View Related
Binary Image Data To PHP - How?
hello,
I wrote an image editor for my cms and wanted to send the image respectively the through the BitmapData's getPixels()-method received ByteArray to a PHP-script that displays and finally saves the image. Obviously I didn't succeed.
How do I have to encode my binary data so that PHP is able to read it and how do I have to treat the bytes in PHP? I also tried encoding the image data with the corelib classes from http://actionscript3libraries.riaforge.org/ but it didn't work as well.
I'd be glad if somebody could help me.
Lukas
View Replies !
View Related
Reading Binary Data
Hi all,
i'm trying to read a binary file containing a sequence of floats created in C.
Loading and reading the file works fine in php, but i can't get this to work
in actionscript:
Here's my approach:
Code:
in the constructor:
...
this.loader = new URLLoader();
this.loader.dataFormat = URLLoaderDataFormat.BINARY;
var bin = new URLRequest("http://path/to/some/binary/file");
this.loader.load(bin);
this.loader.addEventListener(Event.COMPLETE, completeHandler);
...
public function completeHandler() {
var data : ByteArray = loader.data;
while (data.bytesAvailable > 0 ) {
trace(data.readFloat);
}
}
However, the values i get are wrong. They are way too small compared
to the real ones. Around 1.9893951235729634e-38 as they should be
something like 0.234894.
Does anyone see something obvious i might be missing out ?
Thanks for your help.
-pulse00
View Replies !
View Related
Hex/Binary Data Over Socket
I have a custom socket class designed to connect to a server and talk with it. At one point, the server uses hex data for speed, however Flash seems to not get ANY of this data. In fact, it doesn't get ANY of the data from that point to the next packet. Any ideas how to get that data?
View Replies !
View Related
Binary Data And Amfphp
Based on the last amfphp tutorial I've been trying this and it does not work.
I have this php file in the services dir which hace this function that I call throuh actionscript
Code:
function getData($image)
{
$data = mysql_query("Insert into table01 (image) values ('$image')");
if($data == null) {
return false;
}eles{
return true;
}
}
in the mysql database there is a longblob field image and in fd I wrote:
Code:
[Embed(source = 'mail[1].jpg')]
private var _img:Class;
private var img:Bitmap = new _img();
private var gw:NetConnection;
private var res:Responder;
private var TF:TextField = new TextField();
private var ba:ByteArray;
private var encoder:JPGEncoder;
private var bd:BitmapData;
public function Main():void {
TF.autoSize = TextFieldAutoSize.LEFT;
addChild(TF);
bd = new BitmapData(img.width, img.height);
bd.draw(img);
encoder = new JPGEncoder(90);
ba = encoder.encode(bd);
gw = new NetConnection();
gw.connect("http://localhost/amfphp/amfphp/gateway.php");
res = new Responder(onResult, onFault);
gw.call("Test.getData", res, ba.toString());// without toString() amfphp throws me an error that says
//"Object of class ByteArray could not be converted to string"
}
private function onResult(responds:Object):void {
TF.text = String(responds);
}
private function onFault(responds:Object):void {
for (var i:* in responds) {
TF.text = String(responds[i]);
}
}
The blob field in the database is filled with four or five chars but it is not an image.
I believe that the byteArray send to the php file is not the same as sent as amf doesn't serialize it appropriately.
Is there something I missed in the AS or PHP?
View Replies !
View Related
Laoding Binary Data From Jpeg... Possible?
Hello,
I'm using a Mysql database to store pictures in binary data, and I'm searching for a way to import this binary data directly form the database into flash and let flash reconstruct the jpeg.
Getting the data into Flash as a variable is not the problem, it's reconstructing the jpeg from the binary data.
Tx,
Ivan
View Replies !
View Related
Loading/reading Binary Data
Hello all,
I'm currently try to create a kind of GIS tool. My goal is to load data from a server and display a map to the end-user. As map data can be huge to send through "pure" XML, I have to send them in a binary format. Once received, I want to decode my binary data and then display my map.
Unfortunately, as far as I am in my investigations, I do not find a solution to manage these binary data.
Does someone can provide me some solutions or some path of investigation to reach my goal ?
In advance, many thanks,
Alf71.
View Replies !
View Related
XML Combined With Binary Data, Solved =)
Just wanna share my experiences here, heh.
I've been working on a flash-app that writes binary files that another one reads. And I've been wanting to add xml-data to the binary file to easily be able to change a few basic things in the file.
And I thought it would be convenient if the xml and binarydata are part of the same file, instead of having an xml file that holds a url to the binary-file.
So I've been googling for a way of combining them. Found several articles describing just that.
http://www.stylusstudio.com/binary_xml.html
http://www.xml.com/pub/a/98/07/binary/binary.html
http://articles.techrepublic.com.com...1-1050529.html
http://www.perfectxml.com/articles/xml/binary.asp
They listed a few possibilities, but in the end they basically just gave 2 choices. Either store a url to the binary file in the xml, or encode the binary data to text with base64 or UUencode or such.
Encoding a lot of data is slow though, so why should i go that route and have the user wait longer for the app to load when i could just use 2 files...
But then i thought of another idea which I had not read about.
The idea is to have a binary file, which starts with the xml-data. And they are separated with some delimiter byte which is illegal in xml, i went with byte value 3.
In flash, i scan through the file from the start until i reach the delimiter byte, remembers the position of it, go back to position 0, readUTF to the delimiter byte, and make that string into an xml object.
Jump over the delimiter byte and then read the rest of the binary data like normal.
Got it all up and working.. I thought.
Until i changed the xml data using notepad, and then the swf couldn't read the file anymore.
Didn't understand why. Just opening it in notepad and saving it without changes would destroy it.
I inspected the file with a hex-editor and noticed notepad added a couple bytes at the beginning, and sadly it couldn't save all those illegal characters properly.
So my choices basically were to skip this whole thing, or use a hex-editor every time i want to change the xml-data and that doesn't sound very appealing.
Instead I tried a bunch of different text editors¬epads and stuff. Every time i saved, the file got ruined. I was just about to give up when I finally tried Notepad++, which successfully opens, edits, and saves the file without changing the binary data.
And Notepad++ is sweet. Has all kinds of stuff, and has programming language tools. Even for Actionscript!
Syntax Highlighting and Syntax Folding, Auto-completion , Brace and Indent guideline Highlighting(I wish flash had that!!!), Reindent code(Something I fancy, I dont dare using flash's autoformat cause it keeps breaking code) etc, dozens of plugins. Just a great text editor program.
Heh, you probably think I'm weird to put all that work into doing that. And I admit it would probably have been saner to just go with url-to-binary.
I just wont give up when there's something I'm trying to accomplish...
View Replies !
View Related
Loading Binary Data From Jpeg... Possible?
Hello,
I'm using a Mysql database to store pictures in binary data, and I'm searching for a way to import this binary data directly form the database into flash and let flash reconstruct the jpeg.
Getting the data into Flash as a variable is not the problem, it's reconstructing the jpeg from the binary data.
Tx,
Ivan
View Replies !
View Related
Convert A MC To Image Using Binary Data
How can I change this so it saves the image as binary data. This code works fine but when the image is created the file size is too big.PLEASE HELP!!
Code:
import flash.display.BitmapData;
import flash.geom.Rectangle;
import flash.geom.ColorTransform;
import flash.geom.Matrix;
/**
* Little and simple print flash screen class
*/
class PrintScreen {
public var addListener:Function;
public var broadcastMessage:Function;
private var id:Number;
public var record:LoadVars;
function PrintScreen () {
AsBroadcaster.initialize (this);
}
public function print (mc:MovieClip, x:Number, y:Number, w:Number, h:Number) {
broadcastMessage ("onStart",mc);
if (x == undefined) {
x = 0;
}
if (y == undefined) {
y = 0;
}
if (w == undefined) {
w = mc._width;
}
if (h == undefined) {
h = mc._height;
}
var bmp:BitmapData = new BitmapData (w, h, false);
record = new LoadVars ();
record.width = w;
record.height = h;
record.cols = 0;
record.rows = 0;
var matrix = new Matrix ();
matrix.translate (-x,-y);
bmp.draw (mc,matrix,new ColorTransform (),1,new Rectangle (0, 0, w, h));
id = setInterval (copysource, 2, this, mc, bmp);
}
private function copysource (scope, movie, bit) {
var pixel:Number;
var str_pixel:String;
scope.record["px" + scope.record.rows] = new Array ();
for (var a = 0; a < bit.width; a++) {
pixel = bit.getPixels (a, scope.record.rows);
str_pixel = pixel.toString (16);
if (pixel == 0xFFFFFF) {
str_pixel = "";
}
// don't send blank pixel
scope.record["px" + scope.record.rows].push (str_pixel);
}
scope.broadcastMessage ("onProgress",movie,scope.record.rows,bit.height);// send back the progress status
scope.record.rows += 1;
if (scope.record.rows >= bit.height) {
clearInterval (scope.id);
scope.broadcastMessage ("onComplete",movie,scope.record);// completed!
bit.dispose ();
}
}
}
View Replies !
View Related
Loading Binary Data From Jpeg... Possible?
Hello,
I'm using a Mysql database to store pictures in binary data, and I'm searching for a way to import this binary data directly form the database into flash and let flash reconstruct the jpeg.
Getting the data into Flash as a variable is not the problem, it's reconstructing the jpeg from the binary data.
Tx,
Ivan
View Replies !
View Related
Uploading Binary Data With NO HEADERS
I am posting this here as well because some of it relates Flash 8 specifically (FileReference)...
I am trying to send binary data to a server side script which takes a variable called file, and saves it as a binary file.
so if I have a variable in my flash movie "myfile", with a value of "asdf", and I send that to the server, it will make a file on the file system called "myfile", and the contents of it will be asdf
Now, the trick is to send the script an image or video file. I have tried the following ways:
1) Using the FileReference class (Flash 8)
--- This works with php and move_uploaded_file.
--- This does NOT work the server side script mentioned above. It adds headers to the file. The same headers found here:
http://livedocs.adobe.com/flash/8/ma...=00002225.html
Namely:
Content-Type: multipart/form-data; boundary=AaB03x
--AaB03x
Content-Disposition: form-data; name="Filedata"; filename="example.jpg"
Content-Type: application/octet-stream
... contents of example.jpg ...
--AaB03x--
PHP can handle this, the other script cannot. Unfortunately we are stuck with the other script. So I looked at different ways to send binary data to the server, without using FileReference.
2) Flex Builder 2.
Here we have some new classes. Such as URLRequest and URLLoader, where you can use URLLoaderDataFormat.BINARY. This transferred the file to the server using the script we are stuck with perfectly. No errors or problems.
Unfortunately they want a Flash Player 8 solution.
3) Some examples on the web where people have taken a BitmapData object in Flash 8 and programmatically convert a bitmap into an array of string data which represents pixel data, which is converted on the server to an image.
-- Is this method possible with LoadVars to send a binary stream of data to a script via POST, which will make it think it's the same as a file upload???
Well these are my three options
1) FileReference -- Flash 8 --> Is there a way to eliminate the headers its sending by default?
2) Flex Builder 2 - URLLoader class --> Any way to use this in Flash Player 8? (Doesn't seem possible)
3) Manually encode binary data into a variable and pass it through loadVars making the server think it's a file upload. Possible???
OR
4) Any other possibility I may have overlooked?
Thanks for any help,
-Carlos-
View Replies !
View Related
Uploading Binary Data With NO HEADERS
I am trying to send binary data to a server side script which takes a variable called file, and saves it as a binary file.
so if I have a variable in my flash movie "myfile", with a value of "asdf", and I send that to the server, it will make a file on the file system called "myfile", and the contents of it will be asdf
Now, the trick is to send the script an image or video file. I have tried the following ways:
1) Using the FileReference class (Flash 8)
--- This works with php and move_uploaded_file.
--- This does NOT work the server side script mentioned above. It adds headers to the file. The same headers found here:
http://livedocs.adobe.com/flash/8/ma...=00002225.html
Namely:
Content-Type: multipart/form-data; boundary=AaB03x
--AaB03x
Content-Disposition: form-data; name="Filedata"; filename="example.jpg"
Content-Type: application/octet-stream
... contents of example.jpg ...
--AaB03x--
PHP can handle this, the other script cannot. Unfortunately we are stuck with the other script. So I looked at different ways to send binary data to the server, without using FileReference.
2) Flex Builder 2.
Here we have some new classes. Such as URLRequest and URLLoader, where you can use URLLoaderDataFormat.BINARY. This transferred the file to the server using the script we are stuck with perfectly. No errors or problems.
Unfortunately they want a Flash Player 8 solution.
3) Some examples on the web where people have taken a BitmapData object in Flash 8 and programmatically convert a bitmap into an array of string data which represents pixel data, which is converted on the server to an image.
-- Is this method possible with LoadVars to send a binary stream of data to a script via POST, which will make it think it's the same as a file upload???
Well these are my three options
1) FileReference -- Flash 8 --> Is there a way to eliminate the headers its sending by default?
2) Flex Builder 2 - URLLoader class --> Any way to use this in Flash Player 8? (Doesn't seem possible)
3) Manually encode binary data into a variable and pass it through loadVars making the server think it's a file upload. Possible???
OR
4) Any other possibility I may have overlooked?
Thanks for any help,
-Carlos-
View Replies !
View Related
Loading Binary Data From Jpeg... Possible?
Hello,
I'm using a Mysql database to store pictures in binary data, and I'm searching for a way to import this binary data directly form the database into flash and let flash reconstruct the jpeg.
Getting the data into Flash as a variable is not the problem, it's reconstructing the jpeg from the binary data.
Tx,
Ivan
View Replies !
View Related
Socket.readBytes() - Problem Getting All The Binary Data Sent
Hi,
I'm trying to receive data from a Socket() class with readBytes(). It works fine but sometimes not all data sent are received. So lets say my server sent 1500 bytes. 5 out of 6 times the value of connection.bytesAvailable is 1500 (like expected). Bute sometimes it is only 1300 and with the next call of the event handler 200 bytes (so it needs two cycles to fetch all data).
Is there any way to fetch aLL data in one cycle? I tried a while(connection.bytesAvailable > 0) {} but this wont work because of the wrong bytesAvailable value.
Here is my stripped down code of the ProgressEvent.SOCKET_DATA event handler:
ActionScript Code:
private function receiveDataCompleteHandler(event:Event):void {
byteArray = new ByteArray();
connection.readBytes(byteArray, 0, connection.bytesAvailable);
}
Thanks in advance!
Regards, Axeo
View Replies !
View Related
Is It Possible To Use Actionscript To Create Binary Data Objects?
I would like to write an Actionscript class which can convert arrays and other data objects to a serialized format for transmission across a socket connection. I realize this is pretty straightforward in XML but I was hoping for something less bloated and faster like AMF.
Is there any spec out there on how to serialize into AMF format? I've got the AMFPHP source code and have been reading it but that code is in PHP. Also, nearly all open source AMF efforts I have found appear to be reverse-engineering efforts rather than working from any sort of spec.
The bottom line I guess is how might I convert an array, for instance, into some kind of binary format?
View Replies !
View Related
Question About Generate Image Binary Data With Swf File
I want to generate image binary data with swf file.
For example, sprite1 which is Sprite's instance has lots of displaying
object child, we can use addChild(sprite1) to show them on the screen.
I want to generate image binary data from sprite1, the image looks
like the spirte1 displaying in the flash player on the screen. So I
can send the image binary data to server, and save it.
Can any one give me some suggestion, thanks a lot.
PNGEncode is not the way, because PNGEncode read the image information
with getPixel32 method of BitmapData class, but Sprite has no this
method. Please see the bleow code.
var ld:Loader = new Loader();
var url:String = "
View Replies !
View Related
Upload Data From My Movie
Hi everybody,
this is quite a newbie question, I apologize...
Can anybody tell me how I can let the users of my flash page download data from my server, let's say jpgs. I've done this in flash 5 with post method but in flash 8, this seems to be forbidden now. Can you give me a hint?
Thanxs in advance
View Replies !
View Related
F8 Upload & Post Data
I have the upload part working without any hitches at this point - however I have additional information I would like to be able to send along with the upload (i.e. a title, description of the file) - so now my question is - can I add additional fields to be sent via the POST that the upload method performs? and if not - am I able to send back an ID via a postvars or xml type response to the upload so it can send that along with a second send of data?
View Replies !
View Related
Upload Image With Form Data Too
so the problem im having is using fileReference.
i already have a form set up in asp to upload images and a discription.
now i want to move the form into flash to keep the whole app together rather than a pop up html page asking you to browse your file and upload it.
ive found a few examples but dont understand them...or how i can send the rest of the form data that goes with my upload.
i have 3 values that need to come from the form
directoryName=""
imageText=""
then file= browsed file
so far i found somthing like this in the action script help files:
Code:
import flash.net.FileReference;
var allTypes:Array = new Array();
var imageTypes:Object = new Object();
imageTypes.description = "Images (*.jpg, *.jpeg)";
imageTypes.extension = "*.jpg; *.jpeg;"
allTypes.push(imageTypes);
var listener:Object = new Object();
listener.onSelect = function(file:FileReference):Void {
trace("onSelect: " + file.name);
if(!file.upload("http://www.website.com/upload.asp")) {
trace("Upload dialog failed to open.");
}
}
listener.onCancel = function(file:FileReference):Void {
trace("onCancel");
}
listener.onOpen = function(file:FileReference):Void {
trace("onOpen: " + file.name);
}
listener.onProgress = function(file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {
trace("onProgress with bytesLoaded: " + bytesLoaded + " bytesTotal: " + bytesTotal);
}
listener.onComplete = function(file:FileReference):Void {
trace("onComplete: " + file.name);
}
listener.onHTTPError = function(file:FileReference):Void {
trace("onHTTPError: " + file.name);
}
listener.onIOError = function(file:FileReference):Void {
trace("onIOError: " + file.name);
}
listener.onSecurityError = function(file:FileReference, errorString:String):Void {
trace("onSecurityError: " + file.name + " errorString: " + errorString);
}
but.onPress = function(){
var fileRef:FileReference = new FileReference();
fileRef.addListener(listener);
fileRef.browse(allTypes);
}
but dont see how i can add in my extra 2 values to this
when i trace file.name in the fileReference all i get is a name not a full path...
any one know how i could add the extra for data in to this....aside from
http://www.website.com/upload.asp?directoryName="value"&imageText="value"
witch i havent tried yet but if its the only way ill have to go with it...
thanks in advance for any help
View Replies !
View Related
[F8] Receiving Data Back After FileReference.upload...
Hello,
Question is simple... for who have experience working with FileReference class!
I am using FileReference.upload to upload a pic to a certain folder in my remote server. OK, it is working ok. However, I am using the same PHP script that uploads the picture to make a few extra things such as:
a) get uploaded picture height and width;
b) generate a thumbnail of the uploaded picture;
c) get thumbnail height and width.
The point is that those vars MUST be returned to Flash, so I am echoing it back; however I just dont know from WHERE to get them in Flash. When using sendAndLoad, is easy to get PHP vars, since they will be stored in the proper LoadVars, but in this case I have no idea to where they go...
The string I echo back is something like:
&width=300&height=250&ori=landscape&twidth=76&thei ght=63&status=ok&
Anyway, since Flash FileReference.onComplete function is triggered when upload is finished, I believe that it happens when server sends a success message to Flash. If Flash can receive that message am I wrong to suppose that it could receive something else (like my vars)?
Thanks in advance!
View Replies !
View Related
Enduser Upload Of Dynamic Data For .swf Display
I'm looking at a project in which some of the images, text and maybe video will be loaded dynamically off the server. The owner will be periodically uploading more and more of all of these items. When he does, they should be available for display in the interface of the .swf. It may require talking to a database or getting the assets from a directory structure with text files or whatever. I'm fine with programming that aspect of things.
My question pertains to how some of you would have the owner of the site upload his data. A ftp client or database front end is too user unfriendly for him. He's suggested a blog because it would be easy for him to use. I haven't worked that much with them, but I'm concerned that it might be too restrictive and configuring it to my needs could be more trouble than it's worth.
I could build a html form that talks to PHP on the server and upload and store data that way.
Maybe there's a CMS system out there that could handle this easily and make my work easier.
I've done plenty of reading data off of servers, but not much in the way of user front ends in this particular way. Any thoughts on this? Which method would you work with that's not so time consuming to set up and still easy for endusers to use?
View Replies !
View Related
Tutorial: Return Data From A FileReference Upload
Whilst reading through the Comments in the FileReference Documentation I realised there was a lot of people wanting to return data from the upload script (like details of the upload etcetc), but it is not a supported feature.
Since, I NEED to know details of the upload for later use, I solved this riddle very simply. When the upload script recieves the file, set some variables in a session, which flash will request in moments to come. Its not elegant (it REALLY should be native), but its a no-brainer to implement nonetheless:
The server script knows what to do, we check for a file being sent, (manipulate it if it exists then sets some variables for later), otherwise, we simply return the variables to flash
PHP Code:
<?
session_start ();
// MODE 1: The file upload:
if ($_FILES['Filedata']) {
// MOVE THE FILE, RENAME IT, ETC ETC
// [...]
// now set some variables for later use:
$_SESSION['upload'] = array ();
$_SESSION['upload']['myvar'] = "testing 123";
$_SESSION['upload']['anothervar'] = "testing abc";
// MODE 2: Return the data as stored in the session:
} else {
foreach ($_SESSION['upload'] as $key => $val) {
echo "&{$key}={$val}";
}
echo "&eof;";
}
?>
Assuming all your AS is OK, you will just need to modify the onComplete function to something like this:
ActionScript Code:
myFileListener.onComplete = function(selectedFile:FileReference):Void {
myText = "Retrieving Response...";
// Ask the server for the details of the upload:
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean) {
if (success) {
myText = result_lv.myvar;
} else {
myText = "Error connecting to server.";
}
};
var send_lv:LoadVars = new LoadVars();
send_lv.sendAndLoad("your_upload_script.php", result_lv);
};
Et viola! Info, from your script, about your upload!
Viva l'ultrashock
View Replies !
View Related
FileReference, Return Data From Server Side Upload Script
I have php upload code that uploads the file. this works!
now what i need is to return data from the server side upload script to the client.
i do 'echo' with php to print out whatever i want but then inside the completeHandler i get this error.
ReferenceError: Error #1069: Property data not found on flash.net.FileReference and there is no default value.
at ---------------::--------/completeHandler()
PHP Code:
file.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, completeHandler);file.upload(uploadURL);function completeHandler(event:Event):void { _output.text = "completeHandler: " + event.target.data;}
i have also tried
file.addEventListener(Event.COMPLETE, completeHandler);
View Replies !
View Related
FileReference.upload Not Sending Empty Strings In Post Data
Hi all,
Just wanted to know if this is correct behavior. I have created a multiple upload control using AS3 which all works fine, post data is sent etc.
However if any post data contains an empty string, even though it exists in the URLRequest.data object it does not appear in the POST data on the server.
For example :
Code:
var postData:URLVariables = new URLVariables();
postData["test1"] = "something";
postData["test2"] = "";
var request:URLRequest = new URLRequest();
request.method = URLRequestMethod.POST;
request.url = this.uploadURL;
request.data = postData
someFileReference.upload(request, "somePostName", false);
When doing something similar to the above and in PHP printing out the $_POST data, "test1" exists, however "test2" does not.
This is counter to normal form behavior, where if a form element is blank it will still be sent to the $_POST data however it will be blank.
So I was wondering, is this how it is meant to work? Am I doing something wrong? Is there some way to change it to normal form behavior?
Currently testing with version 9,0,124,0
Thanks in advance
View Replies !
View Related
Binary Image In Flash Mx.. Please Help
Hi!
I'm new to Flash Kit and i was told that this is the one place to get help. I have a project from school that I’m trying to get it to work for 3 weeks now and I have to get it running by next week. So any help will be appreciated.
here is the story:
SQL server:
Table name = week15
Fields name:
----> id
----> name
----> lastname
----> content
----> link
----> Image (binary)
Flash MX:
Code:
// set the variables loaded from CF into their respective locations
date_clip.message_date = eval("message_date"+count);
title_clip.message_title = eval("message_title"+count);
message_clip.message_content = eval("message_content"+count);
message_link = eval("message_link"+count);
message_Image.loadMovie("message_Image"+count);
// if the counter reaches the max number of articles then reset it
// if not then increment it
if (count == no_of_feeds) {
count = 1;
} else {
count = count+1;
}
Codfusion:
PHP Code:
<cfcontent type="application/x-www-urlform-encoded">
<cfheader name="pragma" value="no-cache">
<cfheader name="expires" value="#now()#">
<cfquery datasource="#DSName#" name="get_messages" cachedwithin="#createtimespan(0, 0, 30, 0)#">
SELECT *
FROM messages
</cfquery>
<cfset count = 1>
<cfoutput>
<cfloop query="get_messages">
&message_date#count#=#get_messages.message_date#&message_title#count#=#get_messages.message_title#
&message_content#count#=#get_messages.message_content#&message_link#count#=#get_messages.message_link#
&message_Image#count#=#get_messages.message_Image#">
<cfset count=count+1>
</cfloop>
&no_of_feeds=#get_messages.recordcount#&</cfoutput>
End of the Story
Please note that i'm a total newbie and i just need this for getting my Marks. the goal is to display a text and an image that is allready in SQL 2000 using Flash MX and ColdFusion and/or ASP but no PHP.
there is no need to upload anything because the teacher has created a table in SQL Called "week15" and it has 3 Fields: "ID" "Name" and "Image" (binary).
it doesn’t have to be the above code . i just choose it so i can get more marks,
Thank you in advance
View Replies !
View Related
Flash And Binary Image
I have searched the Internet and the Flash Kit Forum and from all of the posts I have found concerning the ability of Flash to retrieve/display a binary image - there basically weren't any answers.
SO... using ASP, I can retrieve and display a binary image that is stored in SQL server.
QUESTION: Can I pass this information on to Flash to display the image?
If so, how do I do this?
Thank you,
Julia
View Replies !
View Related
Gif Image --> Binary -->Flash?
Hi
I am working on a site where I am trying to create the entire site using flash/php4 and mysql.
I am trying to let Flash MX read gif file into the swf, but heared it was only possible with jpg files.
So I was thinking if flash would be able to read binary data from myql? If so would it than be possible to use gifs in flash?
Patrick
View Replies !
View Related
Flash For Mac: How Long Before Universal Binary?
I have an iMac G4 1 GHz PPC and am contemplating purchasing Flash 8 (or some software containing Flash) for my son. I recently found a good educational source with a decent price. To my understanding the current version of Flash is PPC only, but it may be able to run under Rosetta on the new Intel Macs. I have heard that Adobe will not release a universal binary update to Flash 8 and that Flash will likely not run natively on Intel Macs until the next major release of Flash (I guess that will be 9). I plan to keep my G4 for quite a while but I can see some handwriting on the wall that indicates we'll probably get another Mac (Intel) within the year.
A few questions. Has anyone run Flash under Rosetta on an Intel Mac? How does it run? Do you think I should just go ahead and buy Flash 8 now and start getting some good use out of it (the edu discount makes it a pretty good deal anyway)? When is the next version of Flash expected in an ordinary development cycle?
Thanks very much.
View Replies !
View Related
Flash Reading Binary From A Database
i'm storing videos and images inside a blob in mysql and i need to have flash 8 read the files. right now i'm querying the database using php and then converting the php page to xml and then flash is parsing the xml. i need any feedback i can get. thanks in advance.
View Replies !
View Related
Load Binary File In Flash MX 2004?
I've been animating with Flash MX 2004 for about nine months, and am preparing to tackle a project that involves some more serious programming.
I'm hitting a roadblock early on - I need to be able to read a binary file of arbitrary format, either into an array or byte-by-byte from the file. The file will be stored at a URL.
I know Flash MX 2004 has built-in handlers for specific input types, but is there a way to work with a raw binary file in a non-standard format with no meaningful extension in the filename? I looked at the Item class a bit but didn't see an obvious way to pull this off.
I'm wondering if I'm trying to push Flash in a direction it's not intended to go. Any insights will be much appreciated - thanks!
View Replies !
View Related
Importing Binary Files In A Flash CS3 Project ?
Hi,
I know that Flex can import binary files, but it seems a pure Flash project can't do this.
I thought that we could write a little utiliy in whatever scripting language that would turn a binary file into a .as class in this kind :
Code:
var binary:ByteArray=new ByteArray();
var myData:Array=[0x34,0x56,0xF1 etc....... ];
for (var i:int=0;i<myData.length;i++) {
binary.writeByte(myData[i]);
}
What do you think ?
View Replies !
View Related
Loading Jpegs In Flash From Mysql Binary Blob Field.
Greetings actionscripters,
I've been browsing through the threads and tutorials for a solution to this, found stuff, did help, but I'm still stucked.
As the title obviously state, I'm trying to load jpegs into movieclips from blob fields inside mysql database.
It's so easy with text... Why must it be so tough with darn jpegs.
In my .swf I have this tiny snippet in the first frame :
-----------------------------------
_root.myclip.loadMovie("view.php");
-----------------------------------
The view.php file looks like this :
<?
include 'connection.php';
$query = "SELECT id, type, content FROM pictures WHERE id = 2";
$result = @ mysql_query($query, $connection);
$data = @ mysql_fetch_array($result);
$image = $data["content"];
if (!empty($data["content"]))
{
//Begin writing headers
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-type: image/jpeg");
print $image;
}
?>
Then nothing happens, the browser keeps loading ( or think it is loading ) the jpeg but it it never displayed in flash. I managed to load a jpeg from a flat file taken from the webserver, but that is not what I want to do, it must come from the binary blob field.
Theory 1 : Header problem...
Theory 2 : I should use LoadVars instead?
Any help is welcome!
View Replies !
View Related
Upload Script (PHP) Call By FileReference.upload() Can't Read Cookie In NS Or FF
Finally I found the answers to my problem,
these are comment posted on Adobe.com
Hope there is a better solution from Adobe.
Quote:
When swf calling FileReference.upload(handlerURL) method, the handler (which is php server script) can't see session cookies
Steps to Reproduce:
1. page1> setcookie(cookiename,value)
2. page2 swf> FileReference.upload(handlerURL)
3. handlerURL (serverscript)> getcookie(cookiename) return null
Quote:
I CONFIRM THE SESSION COOKIE NOT BEEING SENT WITH THE FILE-UPLOAD POST REQUEST IN FIREFOX 1.5 (NOT TESTED WITH 1.0.X).
THE MULTIPLE FILE UPLOAD FLASH COMPONENT IS USELLES UNTIL THIS BUG IS FIXED BECAUSE WE NEED A SESSION ON THE SERVER SIDE.
Quote:
UPLOAD SESSION COOKIE BUG SOLUTION:
THIS IS HOW TO BYPASS THE BUG ON FIREFOX AND SAFARI WHERE THE SESSION COOKIE IS (UNFORTUNATELY) NOT SENT BY THE FLASH PLAYER.
- IN THE HTML PAGE CREATE A JAVASCRIPT FUNCTION GETCOOKIE() THAT RETURNS THE SESSION COOKIE LOCATED IN 'DOCUMENT.COOKIE' , FOR INSTANCE IF YOU ARE USING PHP IT SHOULD BE NAMED 'PHPSESSID' BY DEFAULT.
- CALL THIS FUNCTION FROM FLASH USING THE EXTERNAL INTERFACE:
VAR COOKIE = STRING(EXTERNALINTERFACE.CALL("GETCOOKIE"));
- APPEND THE COOKIE TO YOUR UPLOAD URL:
.UPLOAD( "/UPLOAD.PHP?"+COOKIE)
VOILA.
ATTENTION:
- DON'T REGENERATE THE COOKIE DURING A SERVER CALL FROM FLASH, BECAUSE THE JAVASCRIPT WILL RETURN ONLY THE COOKIE FROM THE HTML PAGE HOLDING THE SWF.
- UNFORTUNATELY THIS DOESN'T WORK ON OPERA, BECAUSE THE EXTERNAL INTERFACE DOES NOT SUPPORT IT.
- AND CLEAR YOUR COOKIES BEFORE TESTING OF COURSE...
HOPE THIS HELPS...
FRANK.
Quote:
JUST ANOTHER CONFIRMATION: FILE UPLOAD PLUS SESSION COOKIES FAILS ON MAC WITH FIREFOX AND SAFARI, FLASH VERSIONS 8,0,27,0 AND 9,0,20,0. THE FILE GETS UPLOADED JUST FINE BUT THE COOKIES DO NOT GET SET IN THE HTTP REQUEST HEADER.
THIS TYPE OF BUG MAKES ME RECONSIDER POSSIBLY USING FLEX FOR APPLICATION DEPLOYMENT AND REVERT TO JAVASCRIPT + HTML OR JAVA.
more to read:
http://www.visible-form.com/blog/fla...ssion-cookies/
http://robrosenbaum.com/flash/using-...h-php-symfony/
Hope these comments help and save you some time when it happens to you.
View Replies !
View Related
Upload Page ...user Can Upload An Image
Im trying to figure out how I can create a page as described.
I want the customer to be able to go to blbla.html and click browse where appropriate and select the image that he/she wants to upload to the server.
How can I accomplish this in Flash, PHP, or straight HTML. I have a few ideas but never really dealt with someone having that kind of access to a server.
Any help would be great! I would prefer to do this in Flash for usability purposes. thanks!
View Replies !
View Related
Flash Sends Data To PHP, Browser Waiting For Data
Hi,
I have the following problem. I'm implementing a flash form mailer using PHP to send out the mail. I'm doing this in the actionscript to sed out the data:
_root.mcDataField.loadVariables("form.php", "POST");
Then my PHP script looks like this:
$sendTo = "xyz@server.com";
$subject = "Some title here";
$headers = "From: " . $_POST["Name"]. "<" . $_POST["Email"] . ">
";
$headers .= "Reply-To: " . $_POST["Email"] . "
";
$headers .= "Return-Path: " . $_POST["Email"];
$message = $_POST["Message"];
$retVal = mail($sendTo, $subject, $message, $headers);
When I sendthe data, it gets emailed, but the browser shows (in the bottom left corner): "Waiting for xyz.com", where xyz.com is the server I have my files on.
Any idea would be greatly appreciated! Thank you!
View Replies !
View Related
Bug In FileReference: Upload->cancel->upload Not Possible
Hi,
i have written an uploader flash to upload multiple files one after another to a server.
I want to be able to cancel the uploading of a list of filerefences and continue later.
But when i cancel an ongoing upload it is not possible to upload that filereference-object again.
During the second call of upload (after a cancel before) the progress-events are still fired, but not the complete/httperror events. So effectively the upload keeps hanging at the previously canceled filereference.
I tried with Flash 8 and Flash CS3 - with both it was the same problem.
Can anyone confirm this?
Best regards,
Thomas
View Replies !
View Related
Upload-script Doesn't Upload
I'm trying to make a button which can upload multiple files in Flash.
This is my code so far:
AS3: http://pastie.org/320443
PHP: http://pastie.org/320444
The problem is that the console in Flash does say that the files are uploaded, but they are not.
I've tried to replace the PHP to just echo "test"; and Flash still says it is uploaded.
So what is wrong with the script and why does Flash says that files are uploaded when they aren't?
View Replies !
View Related
Binary Question
Hi.
I'm trying to learn how to handle binary functions in flash5 but I'm getting a little confused.
For example, bitwise AND (&)
Code:
1001
& 1100
------
1000
But (as far as I have been able to figure out) flash won't recognize the binary numbers, so I have to convert the binary numbers to decimals:
1001 = 9
1100 = 12
then I get 9 & 12 = 8
But how do I convert 8 (decimal) to 1000 (binary) in flash?
I have managed to do it the other:
Code:
binary = parseInt("1001",2)
trace (binary) // result: 9
Is there a way to make flash understand that it is binary numbers I want to play with or do I have to convert binary to decimal all the time?
And how do I get 9 (dec) = 1001 (bin)???
View Replies !
View Related
|