A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Uploads as "application/octet-stream"

  1. #1
    Join Date
    Jul 2008

    Uploads as "application/octet-stream"

    Hi guys, I have a flex multifile uploader which is great, it uses a php page to 'catch' the uploads. I get the file information on the php page using things like this:

    BUT type ALWAYS comes out as 'application/octet-stream', as in, its not coming out as 'image/jpeg' when its a jpg, etc etc.

    Anybody come across this? is it flex?

  2. #2
    Senior Member Gohloum's Avatar
    Join Date
    Aug 2002
    I am not sure I understand your issue and I am using ASP.NET Web Services to support my flex projects, so this may or may not help you, but maybe someone else.

    I built an FTP file uploader which the FTP part is actually done at the Web Service, so the process is Flex web service call to .NET WebService which connects to some other server via FTP.

    I wanted to make this as open ended as possible so I am actually sending a ByteArray from flex to the webservice which then converts it to a stream and then performs other manipulation there (sometimes image resizing, or passing a video on to a streaming server via FTP). Currently, I have a media manager app that uses this process to send various files (.doc, .pdf, .mp3, .wmv, .img, .jpg, .png, etc) to various other FTP servers which are not the server where the webservice resides.

    I'm not PHP savvy, but I see alot of guys do the same stuff with PHP that I do with .NET so I would imagine there should be some methods or libraries for processing received data on the server side to convert it to some other type.

    What you probably want to do is build you own methods for sending the file data rather than use the upload() method in the filereference object.

    The FileReference object has a parameter called data that is type ByteArray. You just need to wait for it to load into your file reference after selecting before trying to access it.

    Then on your server side you just need to setup your script or service to accept a ByteArray (in C# it is byte[] ), and then transform it to whatever you want.

    Technically you should also be able to do the same coming back to the client, although I would imagine you already know what kind of data you are requesting, so I doubt there would be much reason to.

    To Give you some idea, here is my web method in C# which handles a video file
        public string FtpFlvToLimeLight(string fileName, byte[] fileData)
            string response = "";
            Stream s = new MemoryStream(fileData);
            response = FtpUtils.UploadFlvToLimeLight(fileName, s);
            return response;
    I am using PureMVC, so this code is from my controller, but what is important is the proxy.fetch() function where I am accessing the file name and byte array to pass to the web service
    override public function execute(note:INotification):void 
    			var mediator:FlvUploadMediator = facade.retrieveMediator(FlvUploadMediator.NAME) as FlvUploadMediator;
    			var fileRef:FileReference = mediator.fileRef;
    			var playerMediator:FlvPlayerMediator = facade.retrieveMediator(FlvPlayerMediator.NAME) as FlvPlayerMediator;
    			playerMediator.showProgress = true;
    			var proxy:FlvWSUploadProxy = facade.retrieveProxy(FlvWSUploadProxy.NAME) as FlvWSUploadProxy;
    			proxy.fetch(fileRef.name, fileRef.data);
    I have seen alot of people skin the FTP cat alot of different ways and when I have time, I plan to post a tutorial about my method, but for now, maybe this will help....

    ... Or maybe like I said, I didn't understand your original post, so this could just be mindless ramblings to you...
    The Early Bird may get the worm, but the second mouse to the trap gets the cheese...

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center