[TW5] serve up local file

133 views
Skip to first unread message

Nathan Gleaves

unread,
Oct 7, 2014, 10:47:34 PM10/7/14
to tiddl...@googlegroups.com
I am trying to put a link in my tiddler to a file stored locally on my server. I want to be able to download this file from another machine accessing my wiki. here is what i'm trying to do so far.

[ext[Character Sheet|D:\misc\Wallpaper\05.jpg]]
[[Character Sheet|D:\misc\Wallpaper\05.jpg]]

there are probably other things i have tried but i don't remember, its been to long:( The file there is just a simple test jpg, the file i actually want to serve is an .xls document.

Thanks for your time.

Jeremy Ruston

unread,
Oct 8, 2014, 3:34:43 PM10/8/14
to TiddlyWiki
Hi Nathan

A useful trick is to open the file in question in your browser directly, and then copy the URL from the address bar of the browser.

Best wishes

Jeremy

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.



--
Jeremy Ruston
mailto:jeremy...@gmail.com

Nathan Gleaves

unread,
Oct 8, 2014, 6:59:45 PM10/8/14
to tiddl...@googlegroups.com, jeremy...@gmail.com
This doesn't seem to make any difference. I can copy path from explorer, copy path from sublime text, or manually type it but nothing lets me click the link and download the file.

Nathan Gleaves

unread,
Oct 8, 2014, 8:05:28 PM10/8/14
to tiddl...@googlegroups.com
Alright, I got it working in Firefox but its not what i want. It tries to got o the file address instead of serving the file. What i want is for someone remote to be able to click the link and download the file.

Eric Shulman

unread,
Oct 8, 2014, 8:37:43 PM10/8/14
to tiddl...@googlegroups.com
On Wednesday, October 8, 2014 5:05:28 PM UTC-7, Nathan Gleaves wrote:
Alright, I got it working in Firefox but its not what i want. It tries to got o the file address instead of serving the file. What i want is for someone remote to be able to click the link and download the file.


The default handling for an external link depends on your browser setup.  For example, if you've installed the Excel application on your system, then you've probably also got the Excel addon the lets the browser display XLS files directly, rather than downloading the file.  If the browser doesn't have any addon to support a given file type, then it falls back to download/save the file.

You can force the download handling using HTML5 link syntax (if your browser supports it)
<a href="..." download="somename.ext">click to download</a>
When the link is clicked, the URL in the href="..." will be downloaded, using the specified "somename.ext" as the target name on your local filesystem.

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

YOUR DONATIONS ARE VERY IMPORTANT!
HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...

Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:



Nathan Gleaves

unread,
Oct 8, 2014, 9:32:34 PM10/8/14
to tiddl...@googlegroups.com

 I have a tiddler refined as show above. It renders as above, but the blue test does absolutely nothing when clicked( in chrome). In Firefox it takes me to a new tab with the file system address to the file but does nothing after that.



On Tuesday, October 7, 2014 9:47:34 PM UTC-5, Nathan Gleaves wrote:

Eric Shulman

unread,
Oct 9, 2014, 1:45:55 AM10/9/14
to tiddl...@googlegroups.com
*all* of the links shown in your snapshots are blue... so which one is supposed to be "the blue test"?!?

However, I don't think that really matters, as none of your examples uses a proper local file URL for your external reference.  A local URL should begin with "file:///" (yes, THREE slashes) preceding the drive letter, and the entire path should use *forward* slash (/), not backslash (\).

Thus:
[ext[Character Sheet|file:///D:/misc/Wallpaper/05.jpg]]
[[Character Sheet|file:///D:/misc/Wallpaper/05.jpg]]
<a href="file:///D:/misc/Wallpaper/05.jpg" download="somename.jpg">click to download</a>

I also note that in your previous post showing what you tried, the last attempt has a link to a .jpg file, but uses ".xlsx" as the extension on the download filename. As a general rule-of-thumb, the extension of the downloaded filename should match the actual file content so that the local system can invoke the correct associated program when you open the file.

Nathan Gleaves

unread,
Oct 9, 2014, 8:17:06 PM10/9/14
to tiddl...@googlegroups.com
Using the above corrections, all links give the same result. When i click on any of them i get no apparent response and when i left click and open in new tab, i get about:blank.

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/95ASxgo7nQg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.



--
Thanks,
Nathan Gleaves
Reply all
Reply to author
Forward
0 new messages