Re: [Flashcoders] Sending binary data to server - NO HEADERS
On 3/28/07, Michael Mudge <[EMAIL PROTECTED]> wrote: Although XML basically receives null-terminated XML data, it can *send* any string. You can basically make a rudamentary HTTP client by using it. Foo = new XMLSocket(); Foo.connect("wherever.com", 1234); Foo.onConnect = function() { Foo.send(data); Foo.disconnect(); }; ...something like that? Or... in Flex, you can use a Socket class, which is quite similar... And implement a more complete client. If I had more details, I could probably scribble something up... Also, XMLSocket/Socket cannot connect to ports below 1024, without a special policy server. If they cannot modify the script, I am guessing that installing a separate socket server to hand out policy files is also not possible. See more info here: http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=1099.html What I don't know how to do is read a local file in such a way that I'd be able to use its raw data as a string to send to a socket. Unfortunately this is not possible when running from a browser. Otherwise it would open potential security holes. (Imagine some random SWF reading data from your disk) - Kipp > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf > Of David Rorex > Sent: Wednesday, March 28, 2007 11:34 AM > To: flashcoders@chattyfig.figleaf.com > Subject: Re: [Flashcoders] Sending binary data to server - NO HEADERS > > > It seems like you are doing a lot of work, because of a > poorly-designed server script. I would really try and see if > you can get permission to modify the script. > > If not, perhaps you can have a 'bridge' script, that recieves > the data from flash, formats it correctly for the other > script, then forwards it. > > All the flash 8 methods of sending data to server that I can > think of, will have some sort of header or data format that > will need to be processed first. > > -David R > > On 3/5/07, Carlos Saenz <[EMAIL PROTECTED]> wrote: > > > > 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 > > filesystem 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 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. Same headers found here: > > > > http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/ > > wwhelp.htm?context=LiveDocs_Parts&file=2225.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 side 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? > > ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] Sending binary data to server - NO HEADERS
Although XML basically receives null-terminated XML data, it can *send* any string. You can basically make a rudamentary HTTP client by using it. Foo = new XMLSocket(); Foo.connect("wherever.com", 1234); Foo.onConnect = function() { Foo.send(data); Foo.disconnect(); }; ...something like that? Or... in Flex, you can use a Socket class, which is quite similar... And implement a more complete client. If I had more details, I could probably scribble something up... What I don't know how to do is read a local file in such a way that I'd be able to use its raw data as a string to send to a socket. - Kipp > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf > Of David Rorex > Sent: Wednesday, March 28, 2007 11:34 AM > To: flashcoders@chattyfig.figleaf.com > Subject: Re: [Flashcoders] Sending binary data to server - NO HEADERS > > > It seems like you are doing a lot of work, because of a > poorly-designed server script. I would really try and see if > you can get permission to modify the script. > > If not, perhaps you can have a 'bridge' script, that recieves > the data from flash, formats it correctly for the other > script, then forwards it. > > All the flash 8 methods of sending data to server that I can > think of, will have some sort of header or data format that > will need to be processed first. > > -David R > > On 3/5/07, Carlos Saenz <[EMAIL PROTECTED]> wrote: > > > > 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 > > filesystem 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 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. Same headers found here: > > > > http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/ > > wwhelp.htm?context=LiveDocs_Parts&file=2225.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 side 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- > > ___ > > Flashcoders@chattyfig.figleaf.com > > To change your subscription options or search the archive: > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > Brought to you by Fig Leaf Software > > Premier Authorized Adobe Consulting and Training > > http://
Re: [Flashcoders] Sending binary data to server - NO HEADERS
It seems like you are doing a lot of work, because of a poorly-designed server script. I would really try and see if you can get permission to modify the script. If not, perhaps you can have a 'bridge' script, that recieves the data from flash, formats it correctly for the other script, then forwards it. All the flash 8 methods of sending data to server that I can think of, will have some sort of header or data format that will need to be processed first. -David R On 3/5/07, Carlos Saenz <[EMAIL PROTECTED]> wrote: 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 filesystem 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 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. Same headers found here: http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/ wwhelp.htm?context=LiveDocs_Parts&file=2225.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 side 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- ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Sending binary data to server - NO HEADERS
carlos, what language is the other script (not php) written...i had a similar problem using java...the issue is that there are two headers being sent...one without content to make sure the addres is valid and a second one after with the data..so you need to set up a condition that doesn't do anything when there is no content and handle the one with the content data in it hope this helps On 3/5/07, Carlos Saenz <[EMAIL PROTECTED]> wrote: 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 filesystem 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 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. Same headers found here: http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/ wwhelp.htm?context=LiveDocs_Parts&file=2225.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 side 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- ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] Sending binary data to server - 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 filesystem 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 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. Same headers found here: http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/ wwhelp.htm?context=LiveDocs_Parts&file=2225.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 side 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- ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com