behavior: file

Standard file selector.

Elements

that have this behavior applied by default:

  • <input type=“file” /> - inline single line
  • <widget type=“file”></widget>

These elements placed inside <form enctype=“multipart/form-data”> will cause content of the selected file to be sent to the server.

Attributes

that this behavior knows about:

  • filter=“filename-filter” - defines list of file name filters. filename-filter is list of filter groups separated by semicolon ';' where each group contains filter name, ':' and comma separated list of file masks. Sample:
    <input name="uploadedfile" type="file" 
           filter="HTML files:*.htm,*.html;Text files:*.txt;All files:*.*" 
           novalue="(select file)"/>
  • novalue=“text” - if file was not selected (the input is empty) then it shows text provided by the novalue attribute. You can style this state by using :empty CSS selector.

Events

Together with the standard set of events (mouse, keyboard, focus) behavior: file generates:

  • BUTTON_STATE_CHANGED event - value of the element was changed due to user actions. Posted (asynchronous) event.

Value

type json::value::V_STRING, reports filename selected.

Note that the value is read-only by code. Only user can set the value from UI. That is made intentionally to prevent arbitrary files to be sent from user's computer.

h-smile/built-in-behaviors/file.txt · Last modified: 2010/07/21 22:57 by andrew
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0