OpenFileDialogBox on Web Page

  • Thread starter Thread starter Michael Murphy
  • Start date Start date
M

Michael Murphy

Hi,
Looking for some help with an web page based OpenFile Dialog Box. At this time all I really need is the path and the filename so I can stuff it in a database field. Any pointers would be appreciated.
Thanks,
Michael

--
Michael D. Murphy
Senior Software Architect
SCS-TechResources, Inc.
1400 NW 70 Way
Suite HO1
Plantation, FL 33313-5330
(e-mail address removed)
954-452-1047
 
I would just use the input file HTML object. Once the page is submitted you
can pull all sorts of attributes off the file including name and path from
the PostedFile object. You don't have to save it anywhere unless you want to.

FileName = GetFileNameFromPath(txtPDF_Loc.PostedFile.FileName);
FileSize = txtPDF_Loc.PostedFile.ContentLength;
txtPDF_Loc.PostedFile.SaveAs(DocLoc + FileName);

Ian
 
Thanks for your post, but if I use the html file input control how do i get an event to fire when the user selects the file?

Hi,
Looking for some help with an web page based OpenFile Dialog Box. At this time all I really need is the path and the filename so I can stuff it in a database field. Any pointers would be appreciated.
Thanks,
Michael

--
Michael D. Murphy
Senior Software Architect
SCS-TechResources, Inc.
1400 NW 70 Way
Suite HO1
Plantation, FL 33313-5330
(e-mail address removed)
954-452-1047
 
Nevermind, I found that you have to use a Submit input control. Not the way I wanted to do it, but it works--Thanks!
Hi,
Looking for some help with an web page based OpenFile Dialog Box. At this time all I really need is the path and the filename so I can stuff it in a database field. Any pointers would be appreciated.
Thanks,
Michael

--
Michael D. Murphy
Senior Software Architect
SCS-TechResources, Inc.
1400 NW 70 Way
Suite HO1
Plantation, FL 33313-5330
(e-mail address removed)
954-452-1047
 
Check the docs for System.Web.UI.HtmlControls.HtmlInputFile. You'll be
able to retrieve an HttpPostedFile instance to manipulate the uploaded
file.

If you are just using a path, then the code only works when the
browser is on the same machine as the web server!
 

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

Similar Threads

FileInfo.CopyTo Problem 10
How to Print PRN file 14
Multi-Threading Question 7
How to do Multi-Threading 4

Back
Top