NI Home > Community > NI Discussion Forums
Reply
Member
RGSchmidt
Posts: 84
0 Kudos

Re: How can i make hyperlink to local file for downloading

I don't have a hyperlink control in the vix ... is this required? What is the purpose?

 

The VI in web server is passed in a control (InputFile) and then returns the output file using streaming where the HTTP headers are set ... if this is missing why would it work calling the web service directly but not through Web UI running in IE or Firefox?

 

Thanks

Member
malcolmsmith
Posts: 50

Re: How can i make hyperlink to local file for downloading

If you want to trigger a file download from Web UI Builder, the only way to do this right now is with the hyperlink control. So if that's what you're interested in doing, my screenshot should help with that. (If your service takes inputs, you can also configure the Target URL from the diagram (drop a String Terminal, then link it to the Hyperlink's TargetUrl property):

HyperlinkTerminal.jpg

 

 

If you're not using a hyperlink control, how are you calling the LabVIEW web service for your file to download? If it's with the VIs generated by Import Web Service, or with the HTTP nodes from the palette, these cannot trigger a file download prompt. They are using a networking stack that's independent of the browser. The result of calling these with your service would be that on your UI Builder block diagram, you would have a string / byte array of the downloaded file contents. But there's no way in UI Builder to show the save dialog and pass it this data. The hyperlink control bypasses that altogether, and lets your browser call the web service, which will show the prompt.

Member
RGSchmidt
Posts: 84
0 Kudos

Re: How can i make hyperlink to local file for downloading

I forgot to mention that InputFile is a string control ... this control is used to determine the output file that was created in a previous web service call and stored on the server ... if I connect to the string output of the web service call in Web UI the data is streamed correctly ... the output file name is constantly changing based on the file to be decoded

 

Not sure how to use the hyperlink or what benefit it provides?

Member
RGSchmidt
Posts: 84
0 Kudos

Re: How can i make hyperlink to local file for downloading

How do I pass in a filename to the hyperlink control?

 

I have attached a screenshot ... the user enters filename, presses decode and then presses copy to copy the decrypted file locally.

Member
RGSchmidt
Posts: 84
0 Kudos

Re: How can i make hyperlink to local file for downloading

When I add the hyperlink control and press it then I get the Save As Dialog box ...

 

I have created the hyperlink description when Decode is pressed and now am trying to link the press action of the created hyperlink to the Copy button

Member
malcolmsmith
Posts: 50

Re: How can i make hyperlink to local file for downloading

Sounds like you figured out the hyperlink situation.

 

You can't programmatically trigger the hyperlink control though - you'd have to replace your Copy button with the hyperlink control entirely. If you want it to look more like a button you can put a Rounded Rectangle behind it, or a button where you set Enabled=false, etc.

Member
RGSchmidt
Posts: 84
0 Kudos

Re: How can i make hyperlink to local file for downloading

Thanks :smileyhappy:

 

I totally missed the Hyperlink .... I have removed the buttons and added the hyperlinks

 

You also mentioned in another post of mine for Copying from from local machine to server that I needed to create a combo Web UI and HTML app ... is the HTML code only used for copying the file to the server?

Member
malcolmsmith
Posts: 50
0 Kudos

Re: How can i make hyperlink to local file for downloading

Right, your deployed UI Builder application wouldn't interact with the HTML in any way, and the only HTML you would have to add would be the file upload form.