---
title: "Adressing a fileupload within a repeater"  
description: "Adressing a fileupload within a repeater"  
author: "Anonymous User"  
published: 2014-08-25  
updated: 2014-08-25  
canonical: https://www.mindstick.com/forum/2136/adressing-a-fileupload-within-a-repeater  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 2 minutes  

---

# Adressing a fileupload within a repeater

i have my [fileupload](https://www.mindstick.com/forum/428/is-there-a-way-to-check-fileupload-has-file-or-not-in-client-side-if-it-has-i-want-to-enable-button) within my [repeater](https://www.mindstick.com/blog/197/asp-dot-net-repeater-control)

<asp:[Content](https://www.mindstick.com/articles/13019/get-the-best-content-marketing-pricing-packages-for-your-brand) ID="Content3" ContentPlaceHolderID="content" Runat="Server">

<asp:Repeater ID="rptVrijstellingen" runat="server">

<HeaderTemplate></HeaderTemplate>

<[ItemTemplate](https://www.mindstick.com/forum/2057/access-textbox-in-itemtemplate)>

<h2><%# Eval("tblExternVak.ExternvakNaam") %></h2>

<h4>Selecteer een bestand om te uploaden:</h4>

Gelieve het bestand de naam te geven van het overeenkomstige vak om de verwerking

vlot te laten verlopen.

<br /><br /> <br />

<asp:FileUpload id="FileUpload1"

runat="server">

</asp:FileUpload>

<br /><br />

<hr />

<br />

<br />

<asp:Button id="UploadButton"

Text="Upload file"

OnClick="UploadButton_Click"

runat="server">

</asp:Button>

<br />

<br />

</ItemTemplate>

<SeparatorTemplate><hr /></SeparatorTemplate>

</asp:Repeater>

<asp:[CheckBox](https://www.mindstick.com/articles/291/how-should-use-checkbox-control-in-vb-dot-net) id="CBupload" runat="server" />

<asp:Label id="lblUpload" runat="server"> Geleverd aan Mevrouw Van Orlé</asp:Label>

<asp:Label id="UploadStatusLabel" runat="server" ForeColor="Red"></asp:Label>

</asp:Content>

And i want to adress it from my classfile

if (FileUpload1.HasFile)

{

try

{

String [fileName](https://www.mindstick.com/interview/23463/difference-between-include-filename-and-include-filename) = FileUpload1.FileName;

savePath += fileName;

FileUpload1.SaveAs([Server.MapPath](https://www.mindstick.com/forum/2132/server-mappath-in-asp-dot-net)(savePath));

tblBijlage s = new tblBijlage();

s.bijlageTitel = fileName;

s.bijlageURL = savePath;

s.bijlageType = "1";

s.fk_externvakID = 2;

BLLstudent BLLstudent = new BLLstudent();

BLLstudent.insertFile(s);

}

catch ([Exception](https://www.mindstick.com/articles/1824/objective-c-exception-handling) ex)

{

UploadStatusLabel.Text = ex.Message;

}

}

else

{

UploadStatusLabel.Text = "Gelieve een bestand te kiezen";

}

}

}

The [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) is it doesnt find fileupload1 and any other declared stuff within the repeater, can anyone present me a solution on how to adress the upload within the repeater? (I fill up the repeater with data in my page_load so it exists on load so i know that is not the problem)

[Thank you in advance](https://answers.mindstick.com/qa/40482/why-was-1968-a-year-of-tension-and-turmoil-list-10-events-1-being-the-best-and-10-the-worst-thank-you-in-advance)

## Replies

### Reply by Sumit Kesarwani

Hi Samuel,

You have to iterate the Items collection of Repeater control and use FindControl method to get the reference of FileUpload1 object.

```
foreach (RepeaterItem item in rptVrijstellingen.Items) {    FileUpload file=(FileUpload)item.FindControl("FileUpload1");    String fileName = file.FileName;    FileUpload1.SaveAs(Server.MapPath(savePath + fileName));  }
```


---

Original Source: https://www.mindstick.com/forum/2136/adressing-a-fileupload-within-a-repeater

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
