473,804 Members | 3,156 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 4023
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
2786
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
27908
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
3299
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
2803
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
5666
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
19993
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
20871
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
34021
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
14038
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
9706
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
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10575
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
10330
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...
1
10319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7616
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
6851
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();...
1
4297
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
3
2990
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.