TideSDK popup "save to dialog" onclick <a href=""> - tidesdk

Using the TideSDK, I am creating a desktop app for users able to view and save the file.
In my index.html I have over 50 zipped files which I would like it to prompt user "save to disk" when clicking on the link (as below). How do I solve this? Many thanks!
Example:
<a href="filename1.zip">save to desktop...
<a href="filename2.zip">save to desktop..

You could capture the click, use Ti.UI.currentWindow.openFolderChooserDialog to allow the user to choose a location to download the file too, and then use the Ti.Filesystem api to copy the file to the destination.

Related

Download links in Blazor

I'm programatically creating links to download files of different formats like .csv and .yml.
My code is
<a href="/organs/#organ/#policy/#folder.Name/#file.Name" download>#file.Name</a>
so lets say these links get created:
https://localhost:44372/organs/Heart-Lung/03-15-2020/data/fakedata.yml
https://localhost:44372/organs/Heart-Lung/03-15-2020/data/testdata.csv
the .csv works as it should, I click and it downloads. the .yml however opens a new web page at that link and then says that it can't be found
I'm really not sure what I'm doing wrong, is there a way force it to download or should I be doing this a different way?
I ended up using javascript to do this, based on https://wellsb.com/csharp/aspnet/blazor-jsinterop-save-file/
most of the code is the same, but I changed the link to this to pass in the variable and to keep it as a clickable link that doesn't go anywhere
<a href="javascript:void(0)" #onclick=#(() => DownloadFile(file.FullName))>#file.Name</a>

Download attribute in <a> tag doesn't work when file URL called from sub domain

I have a blog here where I have used an anchor tag (<a>) with the download attribute for an HTML file:
</i>
Screenshot:
Expected: when the user clicks, it should open the dialogue box to download the file.
However, it navigates to the file. AFAIK, it was working earlier. Not sure what happened, or am I missing something? As per this w3schools example, ".html" file is allowed.
Any help would be much appreciated without using JavaScript.
EDIT:
This blog is in a subdomain (http://blog.idevelopweb.site/) and I'm calling the HTML file which is in the root directory (http://www.idevelopweb.site/) so I have used an absolute path.
I may direct you to here.
Your problem is the same origin policy of the download attribute. So either use the same url or relative path.
Download file when clicking on the link (instead of navigating to the file):
<a href="link" download="logo">
Note: The download attribute is not supported in Edge version 12, IE, Safari 10 (and earlier), or Opera version 12 (and earlier)
In your Code
</i>
The href contain link of the webpage instead of the data , image or file which nedded to be downloaded. The webpage cant be downloaded using download attribute of anchor tag.Thus it should be in format:
<a href= "--link of image or file to be downloaded--" download > Download </a>
For example:
<a href="/images/myw3schoolsimage.jpg" download> Download </a>
This download the myw3schoolsimage.jpg image

how to display the "URL" of a zip file as a download button?

am using aldeed:collection2 package for my collection and one of the element in the documents is the URL of a zip file.
I already fetched the URL "item.file" but I want to provide that URL as a button, once clicked the download will start.
How do i do this?
thanks
If it's a .zip file, you just need to wrap it in an <a> tag:
<a class="btn btn-primary" href="{{item.file}}">Click to Download</a>
Note that I'm using Bootstrap classes to make it look like a button.

Show .txt file on a Hyperlink using WordPress

I want to show a text file online as a description when users click on a link, and I want it to be a text file, not the html page. I want it just like this link https://wordpress.org/plugins/about/readme.txt.
I have uploaded the .txt file and it opens when the user clicks hyperlink, but contents of that .txt file are not shown....
Any idea what I did wrong?
Its about File-Permissions, you have to set them to Public & Read
This solution is provided to "Online Sites" only. (Not for XAMPP)
Go to Your Admin Panel
Go to Media
Upload your Textfile to your Webserver
Browse your Textfile (via FTP-Client) and make a RightClick
Set CHMOD to 744. (read)(This are File-Permissions)
Open the File in your Browser and it should appear normally.
I've tested it 5 Minutes ago, it should work for you.
If you check the link using Developer Tools (on Chrome) or using Firebug (on Firefox), you'll know that the file is missing. You have not uploaded the file to that location.

Possilble to auto open a downloaded word document downloaded in browser

The requirement is sent a Word document from browser, and automatically open it on MS Word so that then can view and edit the Word document.
The only solution I can found require the end user to click a dialogue Window in order to open a Word document in Office when the document is download from browser.
Is this the only way, that the user has to click a dialogue Window before Office can open the downloaded Word document?
It kinds of make sense for security reason to not let browser automatically execute an local application (Word.exe) on the local machine, but I still want to confirm that.
If the answer is yes, then I would like to know how to do that?
Edit: I just found out that you have to use inline instead of Attachement, otherwise it will always ask for the option event the browsers are setup properly.
Response.AddHeader("Content-Disposition", "inline;filename=clientquotes.docx");
After made that change, browser will auto open the Word document without asking for action.
If I understand correctly, you want to change the behaviour of your browser to automatically open downloaded files. As far I'm aware its pretty painless process when it comes to Firefox and Google Chrome, however on IE it's not as simple.
Firefox
Changing download actions
This will not affect media embedded in a web page - only links to the files themselves.
Click the menu button Menu and choose Options
Select the Applications panel.
The Applications panel will display. Select the type of file for which you want to change the default action.
The Action column will give you a drop-down menu, with options on action to take, whenever you click that type of file.
Alwaysask: will prompt you to select what action you want Firefox to take when you click on that type of file. This can be useful if Firefox is automatically saving a file type or is always opening it with a certain program and you want to be asked what to do.
Save File: will always save the file to your computer using the Downloads window, whenever you click that type of file.
Open the file with an application or plugin of your choosing.
Click Ok to close the options window after making changes
Adding download actions
On the web, find a link to a file matching the type you want to add.
Click on the file link to download it.
Select how you want Firefox to handle the file:
Open with: Saves the file to a temporary folder and opens it in the default application for that file type. To select an application, click Browse....
Do not choose Firefox to always open a certain file type, as doing so can cause
a problem where Firefox repeatedly opens empty tabs or windows after you click on a link.
Save file: Saves the file to the download folder (specified in the Firefox General panel).
In the Opening file window, check mark Do this automatically for files like this from now on.
Click Ok.
Is Do this automatically for files like this from now on disabled?
This can happen if the website's server incorrectly specifies the
Internet Media type of the file. It also can happen if the server assigns
"Content-Disposition: attachment" to the file.
Reference
Google Chrome
If you want certain types of file always to open after they've finished downloading, click the arrow next to the file button in the downloads bar and select Always open files of this type.
Reference
IE
From what I can gather for IE you will have to change the registry keys. You can refer to this link for further information.
I hope this answers your question.

Resources