How to i convert my output to IResource for uploading file in Dropbox?


i want upload my output to dropbox and this requires IResource how should i convert it In, UiPath web Studio?

Hi @Pdf4me_Flow

What is the type of your output variable that you want to use as input for Dropbox?

If it’s a string variable and contains file path, you can follow below approach.

When your files aren’t stored as an IResource type variable, there’s an option to perform a conversion. Use LocalResource.FromPath(<reference_to_the_file>)in the Input property field for this.

LocalResource.FromPath("Full Path of File you want to Upload") like CurrentFile.FullName if you are using For Each File in Folder activity

@Pdf4me_Flow,

What’s the activity you are using which is returning the output?

Still the file is not getting uploaded to dropbox.

UiPath.Platform.ResourceHandling.LocalResourceImpl.ResolveAsync(Boolean force, CancellationToken ct)
at UiPath.IntegrationService.Activities.Runtime.Services.ExecutionService.ResolveFilePathAsync(Object fileParameter)
at UiPath.IntegrationService.Activities.Runtime.Services.ExecutionService.GenerateMultipartContentAsync(ExecutionParameters executionParameters, String multipartName, ICollection1 jitInputs) at UiPath.IntegrationService.Activities.Runtime.Services.ExecutionService.SendMultipartRequestAsync(String requestUri, ExecutionParameters executionParameters, HttpMethod httpMethod, String multipartName, ICollection1 jitInputs, CancellationToken token)
at UiPath.IntegrationService.Activities.Runtime.Services.ExecutionService.ExecuteOperationAsync(ExecutionParameters executionParameters, ConnectorActivityConfiguration activityConfiguration, CancellationToken token)
at UiPath.IntegrationService.Activities.Runtime.Activities.ConnectorActivity.ExecuteAsync(AsyncCodeActivityContext context, CancellationToken token)
at UiPath.IntegrationService.Activities.Runtime.Activities.AsyncTaskCodeActivityImplementation.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at UiPath.IntegrationService.Activities.Runtime.Activities.AsyncTaskCodeActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Add stamp to pdf using integration service

Hi @Pdf4me_Flow

Could you please confirm below

  1. what is the output type that you are looking to upload to Dropbox?
  2. is it some document/data?

Please note that input for Dropbox upload activity is the file path not the document itself.

the output type is Base64, and it is a Pdf i want to upload

Hi @Pdf4me_Flow

I believe you would need to save that file/output on your local machine first. Or is it already saved?

And then provide the path of that file as iresource type to upload Dropbox activity.

You can refer below post to save that base64 output as pdf file on your machine

Or refer below video

Also, looks like there is a package on marketplace to handle the same as well

Use the Path Exists activity, set it to File, and give it the path and filename. Its output is IResource.

How do i save a output from UiPath web studio? (System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), “Downloads”)) not working for me

I doubt it’s causing the problem, but you don’t need the ( and ) around the expression.

When you say it’s not working, what do you mean? Error? Wrong path? No path? You have to give us specifics or we can’t help you.

As an alternative, since the location of the downloads folder is predictable, you can use…

System.IO.Path.Combine("C:\Users",Environment.UserName,"Downloads")

Hi

Thank you for your reply. We are unable to follow the instructions.

The scenario is , We are using Web studio.

  1. Call api using integration service to convert to PDF. We receive the byte array of the file.
  2. We would like to upload the converted file to Dropbox.

We could call step 1 but we dont know how to do step 2 because it ask for iresource. How can we get iresource from byte array on web studio.

I would really appriciate any help.

You save the file then use either the expression multiple people have told you, or the Path Exists activity as I have told you.

Hi, I am not able to save the file. Is there any activity i need to add or assign?

How to do that was already posted.

Hi Paul

Sorry to ask you same question again.

We are using web studio and we do not know how to save file in web studio. We have bytes but we can nto get the iresource and we dont know how to save the file.

We are new to UI path so please execuse us for basic questions.

Please see the screenshot.

Which activity it is ?
If you get byte array as output you can use below code to save byte array as file using invoke code activity, pass in_byte_array and in_file_path as parameters to it

System.IO.File.WriteAllBytes(<output_file_path_with_extension>, bytes_array)

then use

LocalResource.FromPath(<output_file_path_with_extension>)

to convert file path to IResource

I am getting issue in accessing the string/byte array, how to get output of previoud activity in the code ,
image