You can edit File Drop insertion formats in the File Drop tab of Snippets settings. By using variables in an insertion format, you can insert text that reflects information about the dropped file.
File Drop settings are checked from top to bottom, and the first item whose syntax and extension conditions match is used. An item with no extensions specified matches all files.
The following variables are available in File Drop insertion formats:
| Variable | Description |
|---|---|
<<<ABSOLUTE-PATH>>> | The absolute path of the dropped file. |
<<<RELATIVE-PATH>>> | The relative path from the current document to the dropped file (If the document has not been saved yet, the absolute path is used instead). |
<<<FILENAME>>> | The name of the dropped file including its extension. |
<<<FILENAME-NOSUFFIX>>> | The name of the dropped file without its extension. |
<<<FILEEXTENSION>>> | The file extension of the dropped file. |
<<<FILEEXTENSION-LOWER>>> | The file extension of the dropped file in lowercase. |
<<<FILEEXTENSION-UPPER>>> | The file extension of the dropped file in uppercase. |
<<<DIRECTORY>>> | The name of the directory containing the dropped file. |
<<<FILECONTENT>>> | The text contents of the dropped file (available only when the dropped file is a UTF-8 text file). |
<<<IMAGEWIDTH>>> | The width of the image (available only when the dropped file is an image file). |
<<<IMAGEHEIGHT>>> | The height of the image (available only when the dropped file is an image file). |
You can create insertion formats for different purposes, such as the following examples. These examples assume that the dropped file is in the same folder as the current document.
When a file named “example.html” is dropped:
| Insertion format | Text actually inserted |
|---|---|
<a href="<<<RELATIVE-PATH>>>"></a> |
<a href="example.html"></a> |
When a file named “example.jpg” is dropped:
| Insertion format | Text actually inserted |
|---|---|
<img src="<<<FILENAME>>>" width="<<<IMAGEWIDTH>>>" height="<<<IMAGEHEIGHT>>>" /> |
<img src="example.jpg" width="160" height="80" /> |