473,588 Members | 2,486 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\video s), 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.PostedFi le.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 4005
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***@webpagec oncepts.comwrot e in message
news:11******** **************@ p79g2000cwp.goo glegroups.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\video s), 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.PostedFi le.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.H tmlControls;

[assembly: TagPrefix("Bord ecal.Web.UI.Htm lControls", "bordecal")]

namespace Bordecal.Web.UI .HtmlControls
{
[ValidationPrope rty("Value")]
[AspNetHostingPe rmission(Securi tyAction.Inheri tanceDemand, Level =
AspNetHostingPe rmissionLevel.M inimal)]
[AspNetHostingPe rmission(Securi tyAction.LinkDe mand, Level =
AspNetHostingPe rmissionLevel.M inimal)]
public class HtmlInputFileNa me : HtmlInputText
{
public HtmlInputFileNa me()
: base("file")
{
}
}
}

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

<ke***@webpagec oncepts.comwrot e in message
news:11******** **************@ p79g2000cwp.goo glegroups.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\video s), 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.PostedFi le.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***@webpagec oncepts.comwrot e in message
news:11******** **************@ p79g2000cwp.goo glegroups.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\video s), 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.PostedFi le.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2776
by: Pai | last post by:
Hello there, Good Morning, I am facing a peculiar problem. I have the following code in the html section of my .apsx page <input type="file" runat="server" id="fileBrowse" NAME="fileBrowse">
1
27863
by: Jesper Hermansen | last post by:
Hi! I'm making a system that will generate Winamp-playlists. To make it easy for the user to add a file to the list, I'm using <input type="file">. The problem with this is that I only get the filename, not the path, which is necessary in my situation. I cracked the problem in Firefox:
1
3287
by: Mark Sandfox | last post by:
Is there a way to restrict the user to only selecting and sending either a ..gif or .jpg. Everything I have read says this option can not be done by design (security reasons). I find that irronic as this is the reason (security) that I want to restrict their selection. Any help on this one will be greatly appreciated. The page is using ASP.NET.
10
2782
by: darrel | last post by:
I have an input type="file" field that I am using to accept a file upload. This works, but I'm having problems with the filename property. In firefox, this: MyInputField.postedfile.filename returns the filename...and just the filename. Which is what I want. In IE, however, this returns the ENTIRE local user's system path to the file
2
5653
by: IkBenHet | last post by:
Hello, I am uploading a file using this form in ASP.NET. I have also added a simpel textfield: <form runat="server" enctype="multipart/form-data"> <input type="file" id="oFile" Name="oFile" size="70" runat="Server"> <input type="text" SIZE="20" MAXLENGTH="20" id="Name" NAME="Name"> <input type="submit" id="Submit" runat="Server" value="Submit" OnServerClick="SubmitButton_Click"> </form>
1
19881
by: nad2zen | last post by:
Hi All, How to set the path value to file object using javascript. now i am trying to upload the file without using browse button, but i could not set the path value.. see my code: <form name="thisForm" enctype="multipart/form-data"> <table align="center"> <tr> <td align="left"><b>Select a file to upload :</b></td>
7
20858
by: Tim Slattery | last post by:
I'm trying to handle the onChange event in an <input type="file"> element. In IE, there's no problem: the event fires when a file in the "open" box is doubleclicked, or the "Open" button in the box is clicked, or "Enter" is hit in the attached text box. I can get the value of the element. But in Netscape 7, onChange doesn't fire until focus leaves the element. When you double-click a file name or click "open" in the Open box, the...
5
34007
by: cssExp | last post by:
alright suppose i have the following. <input type="file" name="upload" /> <input type="text" name="discription" /> <input type="image" onclick="addFile();" src="images/addfile.jpg" name="add" alt="Add file" /> Here when user clicks add button, it gets added dynamically in to a div. Which all good and nice, i have very well done so. But here is the problem, on that parent div there are children, children divs contains the input which...
1
14025
by: ChollaPete | last post by:
This code: <form action="processScan.php" method="get"> <p> <?php print "Scan name: <input type=\"file\" name=\"tScanFileName\" value= \"{$scanFileName}\"><br>"; addHiddenCarryons(); ?> <input type="submit">
0
7929
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8228
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8357
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8223
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5729
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3847
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2372
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1196
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.