You are viewing limited content. For full access, please sign in.

Question

Question

Grab Files from Laserfiche File Upload

asked on October 29, 2019 Show version history

We are trying to use Laserfiche forms to upload a file to an API before the file goes into Laserfiche. Basically the process is this.

 

  1. Laserfiche forms brings in Axios(Javascript library for doing easy AJAX calls to and from APIs)
  2. Axios does a POST to the API and brings back a response, which gets stored as form fields, to be used for metadata
  3. Axios grabs a PUT location also during the POST request
  4. Axios does a PUT of the file to the API using multipart/form-data
  5. The form is then submitted to Laserfiche after Axios grabs a response 200 from the Server.
  6. Workflow then handles updating the status of each packet by querying the API every 2 hours or so.

 

Here is the problem I'm running into. With regular HTML file uploads. I can use Javascript to grab the files that Axios uses during the upload(PUT) process. I can't grab the Files from Laserfiche File upload. Here is a few images of the difference.

 

 

 

Upload Packet is the Laserfiche Upload. Upload File is one I made using custom HTML. Here is a chrome snippet of the first Upload

 

Image of both, populated with files

 

 

Chrome console snippet from both.

 

(First one, LF Upload)

 

(Second one, custom HTML File Upload)

 

 

So the Laserfiche file upload doesn't retain the data for me to grab with Javascript, but the Custom HTML5 one does.

 

So the question is, is there any good way, to grab the file from the Laserfiche File Upload component to attach to AXIOS and the AJAX Call?

 

If not, is there a way to fill the Laserfiche File Upload using Javascript, with the file attached to the HTML5 upload?

0 0

Replies

replied on October 29, 2019

Great question. Having the same problem. Anyone else?

1 0
replied on October 29, 2019

Hi Mark,

Though I don't know the answer to your specific question, is there any particular reason you need to make the POST from within the form?

Could you instead have Forms invoke a workflow post-submission that does the following?:

  1. Retrieves the uploaded file and PUT location from Forms
  2. Uses the Workflow HTTP Web Request activity to PUT it to that location

 

My understanding of how Forms handles attachments is as follows:

  1. Forms does not carry attachments/uploads within forms themselves
  2. Forms stores attachments server-side with an attachmentID
  3. Forms associates attachments with forms in its database via attachmentID references
1 0
replied on October 29, 2019 Show version history

Hey Samuel, thanks for the quick response back.

 

We tried this once with Workflow. We actually tried making this a full blown workflow where they just drop a file into a folder, the workflow picks up that starting entry, and then does all the work through Web Activity. We ran into several issues. A lot of the issues we ran into here are actually similar and well documented in this Answers post.

https://answers.laserfiche.com/questions/105820/How-can-I-send-a-file-as-raw-data-as-part-of-HTTP-Form-Post-activity

The main issue being the API expects the file to be sent as a byte array to the server, uses boundaries, etc, etc.

Where as with Axios, we bypass all these problems because it handles sending the file in this format out of the box and takes care of everything in about four lines of code. And it's easier for us to maintain in the future because all of us on the team are Javascript developers.

 

If it can't be done, it can't be done, and we may just make this a web application that interacts with workflow through the Workflow Web Services or some other method. I was just seeing what was possible through forms.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.