0
votes

I am trying to implement a ChatBot application by using UWP (Universal Windows Platform) and Direct line api. Here what I want to achieve is

  1. UWP ChatBot client should be able to start Camera, take picture. The Pictures taken are saved in some local folder.
  2. Next, the ChatBot should be able to upload the pictures to the Bot using
    Direct Line API Upload.

Here I do not want to use FileOpenPicker control. I want to specify the file path and call Direct Line Upload API.

I was able to upload the image file from the following API Test page which is using "File Select Control". https://docs.botframework.com/en-us/restapi/directline3/#

I am wondering it is even possible to upload by specifying the File Path? (Without using File Select Control)

2

2 Answers

0
votes

I was finally able to solve without using FileOpenPicker.

First I saved the Picture in the local storage retured by following.

ApplicationData.Current.LocalFolder.GetFolderAsync("tmp")

Then I called DirectLine Upload API with the image as array of byte. Now its working fine on my Local Computer. But not very sure, this approach is fine for other devices like Mobile etc.

0
votes

I was finally able to solve without using FileOpenPicker.

First I saved the Picture in the local storage retured by following.

ApplicationData.Current.LocalFolder.GetFolderAsync("tmp")

Using temporary app data is the right direction, please see this document: Store and retrieve settings and other app data

The temporary app data store works like a cache. Its files do not roam and could be removed at any time. The System Maintenance task can automatically delete data stored at this location at any time. The user can also clear files from the temporary data store using Disk Cleanup. Temporary app data can be used for storing temporary information during an app session. There is no guarantee that this data will persist beyond the end of the app session as the system might reclaim the used space if needed. The location is available via the temporaryFolder property.

On the Mobile device, the same code should work.