---
title: "Importing Images and Files into Business Central with DataMigrate Pro"
id: "997942"
type: "post"
slug: "import-images-and-files-into-business-central-with-datamigrate-pro"
published_at: "2025-09-12T12:52:15+00:00"
modified_at: "2026-09-02T06:07:00+00:00"
url: "https://ioi.gmbh/en/2025/09/12/import-images-and-files-into-business-central-with-datamigrate-pro/"
markdown_url: "https://ioi.gmbh/en/2025/09/12/import-images-and-files-into-business-central-with-datamigrate-pro.md"
excerpt: "The -t putdata parameter also lets you upload files automatically into a Media or Mediaset field of a specific table in Business Central. The uploaded files are stored in Tenant Media and referenced by a GUID. That GUID is then..."
taxonomy_category:
  - "DataMigrate Pro"
  - "Support &amp; Documentation"
---

Contents

- [Command syntax](#command-syntax)
- [Parameter description](#parameter-description)
- [How it works](#how-it-works)
- [Case 1: upload files from the file system into the [Document Attachment] table](#case-1-upload-files-from-the-file-system-into-the-document-attachment)
- [Case 2: uploading files from a BLOB field in the database](#case-2-uploading-files-from-a-blob-field-in-the-database)
- [Prerequisites](#prerequisites)
- [Supported file formats](#supported-file-formats)

The `-t putdata` parameter also allows files to be uploaded automatically into a **Media** or **Mediaset** field of a specific table in Business Central. The uploaded files are stored in **Tenant Media** and referenced with a GUID. This GUID is then entered in the corresponding **Media** or **Mediaset** field of the target table.

### Command syntax

```
DataMigratePro -t putdata -s <TableNo> -i "<SQL-Befehl>" --automapping <Tabellennummer>
```

or with a manual mapping file:

```
DataMigratePro -t putdata -s <TableNo> -i "<SQL-Befehl>" -m <Pfad zur Mapping-Datei>
```

### Parameter description

- -s <TableNo>Specifies the target table in Business Central into which the files are imported.
- -i "<SQL-Befehl>"Defines the SQL command that supplies the information required for the file transfer.
- --automapping <table number>Automatically creates a mapping for the table and field assignment.
- -m <path to mapping file>Specifies a manual mapping file if --automapping is not used.

### How it works

1. Run SQL queryThe SQL command passed via -i supplies the information required for the file transfer.For the Media or Mediaset field concerned in the Business Central target table, the following three or four columns must be returned:
2. Upload files
3. Link to the Business Central table

### Case 1: upload files from the file system into the [Document Attachment] table

**Preparatory work**

```
CREATE TABLE [dbo].[ContractDocuments](
	[Contract Code] [nvarchar](20) NOT NULL,
	[FileName] [nvarchar](255) NOT NULL,
	[Extension] [nvarchar](10) NOT NULL,
	[Path to File] [nvarchar](512) NOT NULL,
 CONSTRAINT [PK_ContractDocuments] PRIMARY KEY CLUSTERED 
(
	[Contract Code] ASC,
	[FileName] ASC
)
) ON [PRIMARY]
GO
INSERT [dbo].[ContractDocuments] ([Contract Code], [FileName], [Extension], [Path to File]) 
VALUES 
 (N'CONTRACT001', N'Arbeitsvertrag_Befristet.pdf', N'pdf', N'C:\Mustervertraege\Arbeitsvertrag_Befristet.pdf')
,(N'CONTRACT002', N'Arbeitsvertrag_Unbefristet.pdf', N'pdf', N'C:\Mustervertraege\Arbeitsvertrag_Unbefristet.pdf')
,(N'CONTRACT003', N'Ausbildungsvertrag.pdf', N'pdf', N'C:\Mustervertraege\Ausbildungsvertrag.pdf')
,(N'CONTRACT004', N'Kulturvertrag.pdf', N'pdf', N'C:\Mustervertraege\Kulturvertrag.pdf')
,(N'CONTRACT005', N'Bauvertrag.pdf', N'pdf', N'C:\Mustervertraege\Bauvertrag.pdf')
GO
```

Preparation is also required in the mapping configuration, or you create a manual mapping. Here is the first variant, in which the source configuration follows the SQL query and cannot be derived from the structure of NAV, and therefore has to be entered manually.

The SQL query returns the **primary key** (`[ID],[Table ID],[No_]`) and the **file information** for the **media field**`[Document Reference ID]`:

```
SELECT ROW_NUMBER() OVER(ORDER BY [Contract Code]) [ID]
     , 8052 [Table ID] -- Customer contracts
	 , [Contract Code] [No_]
	 , 21 [Document Type] -- Service Contract
	 , 0 [Line No_]
	 , GETDATE() [Attached Date]
	 , [FileName] [File Name]
     , [Extension] [File Extension]
     , [FileName] [Document Reference ID.Description]
	 , CASE WHEN [Extension] = 'jpg' THEN 'image/jpeg' WHEN [Extension] = 'png' THEN 'image/png' ELSE 'application/octet-stream' END AS [Document Reference ID.MimeType]
     , [Path to File] [Document Reference ID.FilePath]
  FROM [dbo].[ContractDocuments]
```

**Command to run:**

```
DataMigratePro -t putdata -s 1173 -i "SELECT ROW_NUMBER() OVER(ORDER BY [Contract Code]) [ID], 8052 [Table ID], [Contract Code] [No_], 21 [Document Type] -- Service Contract, 0 [Line No_], GETDATE() [Attached Date], [FileName] [File Name], [Extension] [File Extension], [FileName] [Document Reference ID.Description], CASE WHEN [Extension] = 'jpg' THEN 'image/jpeg' WHEN [Extension] = 'png' THEN 'image/png' ELSE 'application/octet-stream' END AS [Document Reference ID.MimeType], [Path to File] [Document Reference ID.FilePath] FROM [dbo].[ContractDocuments]" --automapping 1173
```

### Case 2: uploading files from a BLOB field in the database

If the files are stored in an SQL database as a `BLOB`, `.Content` has to be used instead:

```
SELECT 
    [Contract Code] AS [Code], 
    [FileName] AS [Documents.Description], 
    [MimeType] AS [Documents.MimeType], 
    [FileContent] AS [Documents.Content] 
FROM [Some Table with Document Information]
```

**Command to run:**

```
DataMigratePro -t putdata -s 50000 -i "SELECT ..." --automapping 50000
```

### Prerequisites

- The target table in Business Central must contain a Media or Mediaset field.
- If FilePath is used, the files have to be physically present on the server.
- If content is used, the file must already exist as a BLOB in the SQL database.
- The Business Central instance must be configured for the use of media/mediaset fields.

### Supported file formats

- Images: jpg, png, gif, bmp, tiff
- Documents: pdf, txt, docx

About the author

#### Sascha Marquardt

Responsible for the partner programme, the licensing business and commercial project delivery.

Keep reading## More from the IOI blog

[DataMigrate Pro DataMigrate PRO Synch-Service Setting up and running the service bus listener as a Windows service – from the prerequisites to settings.json 24. October 2025 · 4 minutes](https://ioi.gmbh/en/2025/10/24/datamigrate-pro-synch-service/)
[DataMigrate Pro Working with Configuration Data Six ways to move configurations between Business Central, the local installation and a ZIP archive – with the matching commands 23. October 2025 · 2 minutes](https://ioi.gmbh/en/2025/10/23/working-with-configuration-data/)
[DataMigrate Pro Step-by-Step Guide for the Migration to Business Central From the AppSource install to the first migration run – the complete DataMigrate Pro sequence 9. October 2025 · 3 minutes](https://ioi.gmbh/en/2025/10/09/step-by-step-guide-migration-to-business-central/)

## From reading to action. Book your upgrade check.

In the free upgrade check we analyse your current Navision or NAV version and show you the direct path to Business Central – including effort, sequence and a fixed-price range.

[Book a free Upgrade-Check →](/en/business-central-upgrade-check/)
[Give us a quick call: +49 214 8402 3000](tel:+4921484023000)

✓ Directly from any Navision or NAV version

✓ Live test while the legacy system keeps running

✓ C/AL→AL conversion included

✓ Fixed-price range and timeline afterwards
