Browse for external file

6 views
Skip to first unread message

Jon

unread,
Feb 3, 2008, 10:52:13 PM2/3/08
to TiddlyWiki

ExternalTiddlers plugin works great for importing an external file as
a tiddler, but I'd like to be able to browse for the file to import.

I have a tiddler that contains an input field to browse for the file
and a button to invoke a macro to process the result. But the various
methods and properties of place, store, story etc. are still a bit
bewildering, and I haven't been able to figure out how to grab the
file path from the input field in the macro. I could do it with the
FormTiddler and DataTiddler plugins, I guess, but I'd prefer to use
the core functions...clearly, it can be done, since the ImportTiddlers
macro does it.

Thanks for any hints!

Ken Girard

unread,
Feb 3, 2008, 11:44:56 PM2/3/08
to TiddlyWiki
http://tiddlytools.com/#ImportTiddlersPlugin
might be just what your looking for.
Think of it as the standard import with a lot of enhancements
(although it came first)

Ken Girard

Eric Shulman

unread,
Feb 4, 2008, 12:41:34 AM2/4/08
to TiddlyWiki
> ExternalTiddlers plugin works great for importing an external file as
> a tiddler, but I'd like to be able to browse for the file to import.
> I have a tiddler that contains an input field to browse for the file
> and a button to invoke a macro to process the result. But the various
> methods and properties of place, store, story etc. are still a bit
> bewildering, and I haven't been able to figure out how to grab the
> file path from the input field in the macro. I could do it with the

http://www.TiddlyTools.com/#FAQ_CreateTiddlersFromForms

demonstrates how to create a new tiddler from input values contained
in an HTML form. For your purposes you would want to change the
code that constructs the tiddler content, from this:
var txt='|%0|%1|\n
%2'.format([this.field1.value,this.field2.value,this.field3.value]);
to something like:
var txt=loadFile(this.field1.value);
where 'field1' is has been defined in the HTML form by:
<input type="file" name="field1">

HTH,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

Jon

unread,
Feb 4, 2008, 1:52:14 AM2/4/08
to TiddlyWiki

> to something like:
> var txt=loadFile(this.field1.value);

Perfect, thank you!
Reply all
Reply to author
Forward
0 new messages