Path.FilePathToFileURL
----------------------

Converts a file path to a local file URL.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Path](component_Path.md) | [5.0](newinversion50.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Path.FilePathToFileURL"; Path ) 

**MBS**( **"Path.FilePathToFileURL";** /\* Converts a file path to a local file URL. \*/  
**$Path**) /\* The absolute file path to convert to URL.e.g. "/Users/cs/Desktop/test.html" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Path | The absolute file path to convert to URL. | "/Users/cs/Desktop/test.html" |

### Result

Returns URL or error.

### Description

Converts a file path to a local file URL.  
### Examples

Converts a path to a file URL

 MBS ( "Path.FilePathToFileURL"; "/Users/cs/Desktop/test.html" )  
<small>  
Example result: file://localhost/Users/cs/Desktop/test.html</small>Converts a Windows path to file URL:

 MBS ( "Path.FilePathToFileURL"; "C:\\Users\\Christian\\Desktop\\test.html" )  
Write a HTML file and an image file to load in web viewer:

 Set Variable \[ $folder ; Value: MBS ( "[Folders.UserTemporary](FoldersUserTemporary.md)" ) \]   
Set Variable \[ $path ; Value: MBS ( "[Path.AddPathComponent](PathAddPathComponent.md)"; $folder ; "test.jpg" ) \]   
Set Variable \[ $r ; Value: MBS ( "[Container.WriteFile](ContainerWriteFile.md)"; Images::Image ; $path ) \]   
\#   
Set Variable \[ $html ; Value: "&lt;html&gt;&lt;body&gt;&lt;p&gt;Hello World&lt;/p&gt;&lt;img src=test.jpg width=300&gt;&lt;/body&gt;&lt;/html&gt;" \]   
Set Variable \[ $path ; Value: MBS ( "[Path.AddPathComponent](PathAddPathComponent.md)"; $folder ; "test.html" ) \]   
Set Variable \[ $r ; Value: MBS ( "[Text.WriteTextFile](TextWriteTextFile.md)"; $html ; $path ) \]   
\#   
Set Variable \[ $URL ; Value: MBS ( "Path.FilePathToFileURL"; $Path ) \]   
Set Web Viewer \[ Object Name: "web" ; URL: $URL \]  
### See also

- [Container.WriteFile](ContainerWriteFile.md)
- [Folders.UserTemporary](FoldersUserTemporary.md)
- [Path.AddPathComponent](PathAddPathComponent.md)
- [Text.WriteTextFile](TextWriteTextFile.md)
- [WMFP.Create](WMFPCreate.md)

### Release notes

- **Version 13.4**
    - Fixed a problem with [Path.FilePathToFileURL](https://www.mbsplugins.eu/PathFilePathToFileURL.shtml) for Windows.

### Example Databases

- [CURL/Email/Email Parser and Preview](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/Email%20Parser%20and%20Preview.shtml#2ScriptAnchor_)
- [CURL/Email/IMAP Email](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/IMAP%20Email.shtml#6ScriptAnchor_)
- [Network/ServerSocket/ServerSocket from Webviewer/ServerSocket from Webviewer](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Network/ServerSocket/ServerSocket%20from%20Webviewer/ServerSocket%20from%20Webviewer.shtml#3ScriptAnchor_)
- [WebViewer/Calendar/Calendar](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/WebViewer/Calendar/Calendar.shtml#1ScriptAnchor_)
- [WebViewer/MethodDraw SVG Editor/MethodDraw](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/WebViewer/MethodDraw%20SVG%20Editor/MethodDraw.shtml#1ScriptAnchor_)
- [WebViewer/WebViewer MarkDown/WebViewer MarkDown](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/WebViewer/WebViewer%20MarkDown/WebViewer%20MarkDown.shtml#2ScriptAnchor_)
- [Win Only/Windows Player](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Win%20Only/Windows%20Player.shtml#2ScriptAnchor_)

### Blog Entries

- [MBS Plugin Advent calendar: 7 - Paths](https://www.mbsplugins.de/archive/2023-12-07/MBS_Plugin_Advent_calendar_7_-/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 13.4pr3](https://www.mbsplugins.de/archive/2023-08-16/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Use Inline Graphics in Emails](https://www.mbsplugins.de/archive/2021-02-11/Use_Inline_Graphics_in_Emails/monkeybreadsoftware_blog_filemaker)
- [Windows Media Foundation Player for FileMaker](https://www.mbsplugins.de/archive/2019-12-26/Windows_Media_Foundation_Playe/monkeybreadsoftware_blog_filemaker)
- [FileMaker and WebViewer communication](https://www.mbsplugins.de/archive/2018-08-24/FileMaker_and_WebViewer_commun/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 5.0pr9](https://www.mbsplugins.de/archive/2015-02-01/MBS_FileMaker_Plugin_version_5/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 30th January 2015 , last changed 25th February 2026

  
[Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md) - [Path.FileURLToFilePath](PathFileURLToFilePath.md)

[HTML Version](PathFilePathToFileURL.shtml)