---
title: "HtmlInputFile"
type: "forum-thread"
url: "https://www.webforum.nu/amne/dotnet/75925-htmlinputfile"
topic: ".NET"
topic_url: "https://www.webforum.nu/amne/dotnet"
author: "andreas_lindh"
published: "2003-05-05T13:03:14.000Z"
updated: "2003-05-05T21:54:04.000Z"
replies: 2
views: 241
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/dotnet/75925-htmlinputfile"
---

# HtmlInputFile

## #1 — andreas_lindh, 2003-05-05T13:03Z

jag har en HtmlInputFile i en edittemplate i en datagrid.

i codebehindfilen har jag det här

```
Protected WithEvents tbBild As System.Web.UI.HtmlControls.HtmlInputFile
```

och sen när jag kör mitt updatecommand

```
tbBild = e.Item.FindControl("tbBild")
strFileName = tbBild.PostedFile.FileName
```

jag får det här felet

```
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 

Line 137:
Line 138:        'Get the name of the file that is posted.
Line 139:        strFileName = tbBild.PostedFile.FileName
Line 140:        If strFileName <> "" Then
Line 141:            strFileName = Path.GetFileName(strFileName)
 

Source File: d:\inetpub\wwwroot\tibroik.net\admin2\enyheter.aspx.vb    Line: 139
```

Hur ska jag göra för att hitta HtmlInputFile?

Permalänk: https://www.webforum.nu/p/75925

## #2 — renholm, 2003-05-05T20:09Z

Du kan ha glömt att lägga in följande i din \<form\> tag.

```
enctype="multipart/form-data"
```

Permalänk: https://www.webforum.nu/p/1035635

## #3 — andreas_lindh, 2003-05-05T21:54Z

tack :)

Permalänk: https://www.webforum.nu/p/1035750

---

Tråden på webben: https://www.webforum.nu/amne/dotnet/75925-htmlinputfile
