MD5 file format conversion located at box.com

Can I upload a file from other server by using Saaspose api? I want to convert file that located at box.com without downloading to device. But in rest api I need to specify path, and I have an exception when put link uri as a path. So have I any way to get md5 in rest api?

Submitted from: http://saaspose.com/

Hi Kirill,

Sorry for replying late. Our team is looking into this requirement and will get back to you soon.

Thanks & Regards
Shahzad Latif
Saaspose Support Team.

Hi Kirill,

You can load file from download URL into a file stream and then upload it to Saaspose. Can you please share which development platform are you using? This will help us sharing a detailed example with you.

Best Regards,
Muhammad Ijaz

Support Developer, Saaspose Sialkot Team
http://www.saaspose.com

I using java sdk on android device

Hi Kirill,

You can use following UploadFileBinary and getBytesFromFile methods with the following code to upload files from box.com

SaasposeApp.setAppKey("89**********************");
SaasposeApp.setAppSID("77**************************");
// specify product URI
Product.setBaseProductUri("[http://api.saaspose.com/v1.0"](http://api.saaspose.com/v1.0));

String url = "https://dl.boxcloud.com/bc/1/228dc52e69fc1033650bbf63e3b0dac0/JolueqOGpciD6dgYhecNBoVpYxkvmYe1ZLheZor6BF4DUBIelMQTkFwYIys3nIibNIIEHUp447tBZLaXDzIbNQ,,/4dc2574713f832de50f4cce67c2d53da/";

String remoteFileNameAndPath = "folder1/Sample.pdf";
String signedURI = Utils.Sign("http://api.saaspose.com/v1.0/storage/file/" + remoteFileNameAndPath);

--------------------------

public static String UploadFileBinary(String urlFile, String uploadUrl,
String strHttpCommand) {
try {
URL url = new URL(uploadUrl);
byte[] buf = getBytesFromFile(urlFile);
HttpURLConnection m_connection;
m_connection = (HttpURLConnection) url.openConnection();
String parameters = "data=some_post_data";
m_connection.setDoOutput(true);
m_connection.setRequestMethod("PUT");
m_connection.setRequestProperty("Accept", "text/json");
m_connection.setRequestProperty("Content-Type",
"MultiPart/Form-Data");
byte bytes[] = parameters.getBytes();
m_connection.setRequestProperty("Content-length", "" + buf.length);
m_connection.connect();
java.io.OutputStream out = m_connection.getOutputStream();
out.write(buf);
out.flush();

InputStream response = m_connection.getInputStream();

String res = StreamToString(response);

return res;
} catch (Exception e) {
e.printStackTrace();
return null;
}

}

// Returns the contents of the file in a byte array.
public static byte[] getBytesFromFile(String file) throws IOException {
URL url = new URL(file);
url.openConnection();
InputStream is = url.openStream();

ByteArrayOutputStream buffer = new ByteArrayOutputStream();

int nRead;
byte[] data = new byte[16384];

while ((nRead = is.read(data, 0, data.length)) != -1) {
buffer.write(data, 0, nRead);
}

// Close the input stream and return bytes
is.close();
buffer.flush();

return buffer.toByteArray();

}

Please also share which format conversions you are interested in; we already support DropBox, Amazon S3, Google Drive and Google Cloud storages and planning to support Box.com storage to let you convert directly from Box.com.

Best Regards,
Muhammd Ijaz

Support Developer, Saaspose Sialkot Team

Hi Kirill,

Did the last suggestion from our team help in your scenario? Are you able to move forward with the Saaspose API? I would also like to share that we have published an SDK specifically built and tested on Android; you can download it from the following link: GitHub - aspose-words-cloud/aspose-words-cloud-java: A Java library for communicating with the Aspose.Words Cloud API. You can also get a complete test project for the Android SDK from the following repository: https://github.com/aspose-words-cloud/aspose-words-cloud-java/tree/master/src/test/java/com/aspose/words/cloud/api. I hope this will be helpful.

If you need any further assistance, please do let us know. We’ll be glad to help you.

Thanks & Regards
Shahzad Latif
Saaspose Support Team.