By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,558 Members | 1,533 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,558 IT Pros & Developers. It's quick & easy.

INPUT Type="FILE" - Just want to get the file name and path as string

P: n/a
Hi, I am trying to create a page so the user can browse the network,
select a file and have that file name (text) inserted into our sql DB
so I can build the hyperlink path later on.

Here's what seems to be the problem. These are video files and are
enormous with long crazy names so trying to hand type the file name in
a text box is not an option. So I'm using an Input "file" control so
when the user browses out onto the network (Z:\drive\videos), gets the
file path into the Input file text box and then hits the insert control
to process the filename it bombs because the files are too huge
(100+MB). I just want to get the name to a string and not actually get
the file.

MyFile.PostedFile.FileName is great but it seems to have to process the
file and not just give me the text of the file after I browsed.

If this makes any sense, any help would be great. Thanks K

Aug 1 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
It does. But short of using an ActiveX control, I don't think you'll find a
workaround. Even JavaScript is extremely limited in what it can help you
with - namely because of potential security issues.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
<ke***@webpageconcepts.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
Hi, I am trying to create a page so the user can browse the network,
select a file and have that file name (text) inserted into our sql DB
so I can build the hyperlink path later on.

Here's what seems to be the problem. These are video files and are
enormous with long crazy names so trying to hand type the file name in
a text box is not an option. So I'm using an Input "file" control so
when the user browses out onto the network (Z:\drive\videos), gets the
file path into the Input file text box and then hits the insert control
to process the filename it bombs because the files are too huge
(100+MB). I just want to get the name to a string and not actually get
the file.

MyFile.PostedFile.FileName is great but it seems to have to process the
file and not just give me the text of the file after I browsed.

If this makes any sense, any help would be great. Thanks K

Aug 1 '06 #2

P: n/a
The HtmlInputFile control sets the form's enctype to "multipart/form-data"
in their OnPreRender methods, which is what causes the file to be uploaded.
You could avoid this by creating your own file name control by subclassing
the HtmlInputText control:

using System;
using System.Security.Permissions;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;

[assembly: TagPrefix("Bordecal.Web.UI.HtmlControls", "bordecal")]

namespace Bordecal.Web.UI.HtmlControls
{
[ValidationProperty("Value")]
[AspNetHostingPermission(SecurityAction.Inheritance Demand, Level =
AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.LinkDemand, Level =
AspNetHostingPermissionLevel.Minimal)]
public class HtmlInputFileName : HtmlInputText
{
public HtmlInputFileName()
: base("file")
{
}
}
}

The above control would expose the selected file name via its Value
property.

<ke***@webpageconcepts.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
Hi, I am trying to create a page so the user can browse the network,
select a file and have that file name (text) inserted into our sql DB
so I can build the hyperlink path later on.

Here's what seems to be the problem. These are video files and are
enormous with long crazy names so trying to hand type the file name in
a text box is not an option. So I'm using an Input "file" control so
when the user browses out onto the network (Z:\drive\videos), gets the
file path into the Input file text box and then hits the insert control
to process the filename it bombs because the files are too huge
(100+MB). I just want to get the name to a string and not actually get
the file.

MyFile.PostedFile.FileName is great but it seems to have to process the
file and not just give me the text of the file after I browsed.

If this makes any sense, any help would be great. Thanks K
Aug 1 '06 #3

P: n/a
don't use the file control. have a page that builds a list doing a
directory.

-- bruce (sqlwork.com)
<ke***@webpageconcepts.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
Hi, I am trying to create a page so the user can browse the network,
select a file and have that file name (text) inserted into our sql DB
so I can build the hyperlink path later on.

Here's what seems to be the problem. These are video files and are
enormous with long crazy names so trying to hand type the file name in
a text box is not an option. So I'm using an Input "file" control so
when the user browses out onto the network (Z:\drive\videos), gets the
file path into the Input file text box and then hits the insert control
to process the filename it bombs because the files are too huge
(100+MB). I just want to get the name to a string and not actually get
the file.

MyFile.PostedFile.FileName is great but it seems to have to process the
file and not just give me the text of the file after I browsed.

If this makes any sense, any help would be great. Thanks K

Aug 1 '06 #4

P: n/a
Did it. Perfect. Thanks!
bruce barker (sqlwork.com) wrote:
don't use the file control. have a page that builds a list doing a
directory.

-- bruce (sqlwork.com)

Aug 2 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.