469,616 Members | 1,720 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,616 developers. It's quick & easy.

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

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
4 3718
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
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
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
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.

Similar topics

1 post views Thread by Pai | last post: by
1 post views Thread by Jesper Hermansen | last post: by
2 posts views Thread by IkBenHet | last post: by
7 posts views Thread by Tim Slattery | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.