Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

custom function to form a url to download a document based on key

Tags:

onlyoffice

i am using integrated document server 4.4.3 ubuntu based, bellow code is customized for my suitability, how can i form a url based on key

asc_docs_api.prototype.asc_customCallback     = function(typeFile, bIsDownloadEvent)
{

    var actionType =  c_oAscAsyncAction.DownloadAs;
    var options    = {downloadType : DownloadType.Download };
    this._downloadAs("save", typeFile, actionType, options, function(incomeObject){
    if (null != incomeObject && "save" == incomeObject["type"]) {

           //incomeObject["data"]  will return key of the document instead of key, i need full url of the document with md5 and expires like below 

           //ex: http://cache/files/.....


    });
};

thank you in advance

like image 850
Kalaiselvan Avatar asked Sep 18 '17 07:09

Kalaiselvan


People also ask

How to get data from the URL of a file?

Paste the URL of the file. Use the get method to retrieve the data from the URL pasted. Give the name and format of your choice to the file and open it in the write mode.

How to download files from URL in Python?

Download files from URL in Python. Problem statement: Write a python program to download a file using URL. Steps/Algorithm: Import the requests module. Paste the URL of the file. Use the get method to retrieve the data from the URL pasted. Give the name and format of your choice to the file and open it in the write mode.

How to save a code from a URL?

Give the name and format of your choice to the file and open it in the write mode. Write the entire contents of the file to successfully save it. The required file from the URL will automatically get downloaded and saved in the same folder in which code was written.

How do I use the download attribute in HTML?

Try it Yourself » The downloadattribute is only used if the hrefattribute is set. The value of the attribute will be the name of the downloaded file. There are no restrictions on allowed values, and the browser will automatically detect the correct file extension and add it to the file (.img, .pdf, .txt, .html, etc.).


1 Answers

You are trying to get the link too early, the file is not yet available, the conversion process might not be completed. This callback only means that the conversion task is created

But you can try using the function onDownloadAs (created for the integrators who are going to create external button downloadAs) http://api.onlyoffice.com/editors/config/events#onDownloadAs A link to the file will be sent to: asc_docs_api.prototype.processSavedFile = function(url, downloadType)

like image 117
ibnpetr Avatar answered Oct 14 '22 14:10

ibnpetr