Unsolved

This post is more than 5 years old

12 Posts

13271

May 23rd, 2009 07:00

Uploading a file on Atmos

Hello Everyone,

I am new to programming and FLEX,Can any one please help me or give me an example on how to upload data to Atmos using the FLEX Bindings.

Thanks in advance...

281 Posts

May 28th, 2009 09:00

RaghuSM wrote:

Hi Jason,

Thank you very much for the response....

One question: Can you please let us know what path has to be mentioned in pathinput.text?

Hi Raghu,

For the sample code in the document, the pathinput should be filled with the path inside atmos (a.k.a. 'namespace path').  For example /root/myfiles/

12 Posts

June 2nd, 2009 03:00

Hi Jason,

This is a lot of info and is very hepfull for me , but i have not yet uploaded anything to atmos .

As per the example code you have provided is

serviceObject.listDirectory(new ObjectPath(pathInput.text), handleResponse, null);

here ListDirectory returns all the objects in the specified directory as an array of DirectoryEntry objects but it would be helpful for me if you can show me an example on how to create a new object in the cloud and upload a file using Uploadhelper ?

Thank you for the response ,

Hemanth

281 Posts

June 7th, 2009 11:00

Hi Hemanth,

Attached is a simple application that will upload a file to Atmos.  You will need FlexBuilder 3.0.2 (Flex 3.3 SDK) and Flash 10 for it to work.

Regards,

Jason

1 Attachment

281 Posts

June 9th, 2009 07:00

RaghuSM wrote:

The code ran without any errors after installing flash player 10 and running the code with SDK 3.3 compiler

After the code is executed we are getting the below error:

Security sandbox violation:

Please suggest.

Are you seeing that in your debug window or in the application?  I've seen it in the debug logs long after requests to Atmos are done.  It does not appear to affect application performance.  I believe it is a bug that occurs in Flash when it tries to dispose the socket used for the request.

281 Posts

June 10th, 2009 12:00

JasonCwik wrote:

RaghuSM wrote:

Yes Jason. That's true. This error comes after the requests are made to atmos.

What my understanding is when we upload some files the disk usage should be shown in the internal.emccis.com

But I dont see any disk usage against my account.

From what I've heard, the disk usage does not immediately update.  It may take a day or so to see it in the dashboard.

Actually, I was wrong.  It's hourly.  See: https://community.emc.com/thread/3525?tstart=0

281 Posts

June 10th, 2009 12:00

RaghuSM wrote:

Yes Jason. That's true. This error comes after the requests are made to atmos.

What my understanding is when we upload some files the disk usage should be shown in the internal.emccis.com

But I dont see any disk usage against my account.

From what I've heard, the disk usage does not immediately update.  It may take a day or so to see it in the dashboard.

Also I executed the code provided by you named EMC Flex Client Overview (1).docx

But it did not list any files under root directory instead, it also returned the same error: Security sandbox violation:

I've attached an updated sample app with 'check upload' and 'list directory' buttons.  After upload, you can press the 'check upload' button to see if the file exists (and its size) and then click list directory to view the directory contents.

1 Attachment

2 Posts

June 15th, 2009 07:00

shridevi -

If you created the objects via the namespace, you should be able to do a ReadObject on the directory to get the ObjectIDs of the files in the directory.

/Chris

281 Posts

June 16th, 2009 16:00

RaghuSM wrote:

Thanks for the response Chris.

I tried readObject() function,the function reads the contents of file but returns void.please could you elaborate how can we get the ObjectIDs using readObject().

We have uploaded the files using name space, can you help with the download of files either using namespace or objectID.

Hi Raghu,

All of the functions in the Flex API are asynchronous.  They return immediately and give you results later through the callback.

For readObject, the callback state object will contain a ByteArray in the result field.  For example:

public function readObjectCallback( state:EsuCallbackState ):void {

  if( !state.wasSuccessful() ) {

    // Handle error

    Alert.show( state.getError().message, "Error reading object", 4, this );

    return;

  }


  var data:ByteArray = ByteArray( state.result );


  // Process data

}

281 Posts

June 17th, 2009 07:00

Can you attach your whole program?  It sounds like your file object is null.  You have to initialize the FileReference object before you can save().

281 Posts

June 19th, 2009 15:00

It's definitely the FileReference.  The code in onDownloadCompletion should look more like this:

private function onDownloadCompletion (state:EsuCallbackState):void {

  if( !state.wasSuccessful() ) {

    Alert.show( state.getError().message, "Error Downloading", 4, this );

    return;

  }

  d_file = new FileReference();

  d_file.save(ByteArray(state.getResult()), downloadfile.text);

}

In addition, I would recommend adding event handlers to d_file before calling save() so you can get notified that the save is complete and/or failed.  See onUploadClick() for how to addEventListener.

12 Posts

June 28th, 2009 04:00

private function onSave():void{
               
                var esu:EsuApi = new EsuRestApi( serverText.text, 80, uidText.text, secretKeyText.text );
                var id:ObjectId = new ObjectId( "4980cdb2a110105804980d83b1853504a4748c2f02e7");
                var downloadHelper:DownloadHelper = new DownloadHelper( esu );
                downloadHelper.addEventListener( Event.COMPLETE, onComplete );
               
                var data:ByteArray = new ByteArray();
                downloadHelper.readObject( id, data );

           
            }
            function onComplete( event:Event ) {
                var downloadHelper:DownloadHelper = DownloadHelper( event.target );   
                var data:ByteArray = ByteArray( downloadHelper.stream );
                // Do something with the data
}

I have downloaded file from atmos and it is stored in data(ByteArray ), can anyone tell me how to store this content into text fle ??

Thanks,

Hemanth

281 Posts

June 29th, 2009 07:00

Hi Hemanth,

With Flex 3.2 and Flash Player 10, you can use the FileReference class to save a byte array to a file.

  d_file = new FileReference();

  // register event handlers for complete and error

  d_file.save( byteArray, suggestedFilename );

http://livedocs.adobe.com/flex/3/langref/flash/net/FileReference.html#save()

281 Posts

July 28th, 2009 06:00

Hi Raghu,

Unfortunately, it looks like you're at the mercy of the Flash sandbox here and this is the best way to do it.  The only other alternative I can think of would be to write an Air application and pass the download operation to the Air application from Flash.  You're not sandboxed once you get into Air and can read and write files at will.

http://livedocs.adobe.com/flex/3/html/help.html?content=Part2_DevApps_1.html

0 events found

No Events found!

Top