download successful but how to get the file from the response ?

0 votes

allo akshay

i'd a callback before this:            uploadService.GetFileByName(sFileNameDateTimenew a42callBack_fileDownload());

and was successful,  but how do i extract from the response object ??

in the callback class method onSuccess(object oResponse){

Upload upload = (Upload)oResponse;

upload.xxxx ?? 

i find no direct way to retrieve the downloaded file.

also how come no download object to refer instead of Upload ?

that is a bit confusing.

 

regards.

daniel

asked Sep 11, 2014 in App42 Cloud API-BaaS by mrdaniel (10 points)

1 Answer

0 votes
Hello Daniel,
 
When you upload the file, you will get an HTTP end point of uploaded file. You can use this URL to fetch and download uplaoded file in your app.
 
Please find the code snippet below to retrieve file URl along with file information from Upload Object:
 
Upload upload = (Upload)oResponse;
        IList<Upload.File>  fileList = upload.GetFileList();
        for(int i=0; i < fileList.Count; i++)
        {
       App42Log.Console("fileName is " + fileList[i].GetName());
            App42Log.Console("fileType is " + fileList[i].GetType());
         App42Log.Console("fileUrl is " + fileList[i].GetUrl());
         App42Log.Console("fileDescription is " + fileList[i].GetDescription());
        }
 
Let me know if it helps.
 
 
Thanks,
Himanshu
answered Sep 11, 2014 by hs00105 (2,005 points)
that code snippet was already with me from previous prototype but i do not get the actual file back. fileList[i].GetName() only provides the name not the actual file which i need to read data to be reprocessed.
i reckon after a successful download the object is kept in memory so i need to access its data.

regards.
daniel
Hello Daniel,

fileList[i].GetUrl() will give you the actual file HTTP URL which you can use to download the content and show it in your app.

 
Let me know if it helps.
 
Thanks.
Himanshu Sharma
you should have given me the complete statement as leaving out the left-hand side of the equation had me going through your documentation but found no hint as to how to get the file: for example i did this:
File f = iListUploadFile[0].GetUrl();
but the compiler is not happy with it.

reviewing the debug log saw the fileURL was:
http://cdn.shephertz.com/repository/files/d33f93c84f7f073b59af62e4fa507753b73fae53eb15c852da719a24837c0d5b/c1c6545b09fef34f0973a8f70b1fbadcf6ffcbd3/wordDATA.dat20140912:Fri121330

but then how do i download from there ?

please advise.

regards.
daniel
on second thought since your api enables uploading of file from the app why not able to directly download the stored file back to the app ????
that's workflow dependency seemed to have broken !@#$%^&*

daniel
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...