Open Closed

How to use TempFileCacheManager class #8204


0
timmackey created

I am able to observe that TempFileCacheManager.SetFile(string token, byte[] content) on the server is called when uploading a file using 'ng2-file-upload'. I would like to use the same intereface to upload a .jpg image from the TWAIN scanner browser extension by Dynamsoft (installed via yarn as 'dwt@15.2") I downloaded the 'valor-software/ng2-file-upload' project source file from github. While I can see the the emit code (that.response.emit(xhr.responseText) on line376 of 'file-uploader.class.ts' file, I don't see any reference to SetFile(...). Is the 'emit' call intercepted by Abp which then invokes 'SetFile'? If yes, where is the documentation? How can I upload a browser-created image (not a file from local storage) to the TempFileCache?


10 Answer(s)
  • 0
    ismcagdas created
    Support Team

    Hi @timmackey

    We haven't used valor-software/ng2-file-upload in what way. Did you investigate this on valor-software/ng2-file-upload's GitHub repo ?

  • 0
    timmackey created

    Yes, I got the code from GitHub repo. Sorry for the missing info. ANZ is using 'ng2-file-upload' to upload user profile picture. I use the same technique to upload pictures for my users. I would like to upload images in client memory (not local storage) to server service TempFileCacheManager.SetFile(string token, byte[] content). How can this be accomplished?

  • 0
    ryancyq created
    Support Team

    Hi, do you mean to upload a file from the user's clipboard?

    e.g. copy and paste the file?

  • 0
    timmackey created

    I would like to upload a BMP image (a stream of bytes) from memory - not a file on the user's system. Please refer to my initial post for details.

  • 0
    ismcagdas created
    Support Team

    Hi @timmackey

    Have you solved this problem ?

  • 0
    timmackey created

    @ismcagdas - this problem has not been solved.

  • 0
    ismcagdas created
    Support Team

    Hi @timmackey

    Did you try using addToQueue ?

  • 0
    timmackey created

    I don't have direct access to the image bits. All I can do is notify the dwt driver of where to send the bits. How did ANZ configure ng2-file-upload to send bits to TempFileCacheManager.SetFile (and not some other name, like 'SetMyFile')? The problem might become clearer if you installed 'dwt'.

  • 0
    timmackey created

    Still need help with this.

  • 0
    ismcagdas created
    Support Team

    Hi @timmackey

    We use ng2-file-upload with a regular html file input. We don't make any special configurations. Maybe you should look for another file uploader.