File Upload in Business Layer

T

Terry Holland

Im writing an application with an ASP.Net (VB.Ney) GUI, Business Layer and DAL.

I need to implement a facility to allow the users to upload files. The only
examples I can find for doing this use the
System.Web.UI.HtmlControls.HtmlInputFile control on a webform to upload the
files. I want to use a webform to allow the user to select a number of
files, have details of the files that need to be uploaded in a collection
that will be passed to the business layer and, when the Upload button is
clicked have the details of all of the files in the collection passed to the
business layer (and then DAL) and have this layer perform the file upload.
The only way I can see to do this is to have the a parameter in the BLL of
type System.Web.UI.HtmlControls.HtmlInputFile which will give the BLL access
to the upload file properties. This doesn't seem 'correct' because that
would require that the BLL needs to have awareness of the GUI implementation
(ie HTML control).

Is there any way I can pass enough information from the GUI to BLL without
the BLL knowing that the GUI is a HTML control
 
B

bruce barker

this approach will not work. the only way the server can "see" the file
info is to have the user upload the file. if a file is select in a
<input type="file">, when a submit is done (a postback) the file is sent
to the server.

most apps will allow the upload files in an attachment metaphor (see
mail programs) or have javascript add additional input controls, and
upload the files at once.

one issue to face with .net, is the default file/upload handling load
all posted files into a in-memory collection, then calls the page
processing. if the collection get too large (set in web config), the
connection is closed to stop the upload from the client.

so in you case the files are in memory before a bal/dal call can be
made, so you can just put pass the files collection.

-- bruce (sqlwork.com)
 
T

Terry Holland

Thank you bruce
so in you case the files are in memory before a bal/dal call can be
made, so you can just put pass the files collection.

This is the approach I started working on
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top