473,508 Members | 2,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Selecting a file client side

Hi.

I know how to use <input type=file runat=server> to upload a file to the
webserver.
However, my files are 2gb and I don't want to up load them.

What I would like to be able to do is to just get the filename of the file
the user selected (for example "c:\temp\movie.wmv").
I also want validation that requires the selection of a .wmv file.

What is the best way to do that?

Thanks
Nov 18 '05 #1
3 1085
Ken
Add this to the HTML designer page

<INPUT id="MyFile" type="file" name="MyFile" runat="server">

Then you can refer to the 'MyFile' object in the code behind.

MyFile.PostedFile.FileName

"Dave56" <no****@co.lane.or.us> wrote in message
news:uw**************@TK2MSFTNGP10.phx.gbl...
Hi.

I know how to use <input type=file runat=server> to upload a file to the
webserver.
However, my files are 2gb and I don't want to up load them.

What I would like to be able to do is to just get the filename of the file
the user selected (for example "c:\temp\movie.wmv").
I also want validation that requires the selection of a .wmv file.

What is the best way to do that?

Thanks

Nov 18 '05 #2
Thanks,

I have tried that, but .net is automatically setting the Enctype property of
the HtmlForm to "multipart/form-data".
So it is trying to upload the file.

MSDN says:
When uploading large files, use the maxRequestLength attribute of the
<httpRuntime> element to increase the maximum allowable file size. A DNS
error is generated in the browser when the file exceeds the specified size.

Since the file is huge I get this error.

Besides, I just want the name of the file and not to actually have it
uploaded.

Is there any way to get around this?

Dave56
"Ken" <kf******@hotmail.com> wrote in message
news:uK**************@TK2MSFTNGP10.phx.gbl...
Add this to the HTML designer page

<INPUT id="MyFile" type="file" name="MyFile" runat="server">

Then you can refer to the 'MyFile' object in the code behind.

MyFile.PostedFile.FileName

"Dave56" <no****@co.lane.or.us> wrote in message
news:uw**************@TK2MSFTNGP10.phx.gbl...
Hi.

I know how to use <input type=file runat=server> to upload a file to the
webserver.
However, my files are 2gb and I don't want to up load them.

What I would like to be able to do is to just get the filename of the file the user selected (for example "c:\temp\movie.wmv").
I also want validation that requires the selection of a .wmv file.

What is the best way to do that?

Thanks


Nov 18 '05 #3
He said he didn't want to upload them. If you put an input type=file HTML
element in a page, and the user browses to a file and submits the form, the
file will be uploaded, regardless of whether the app saves it or not. With a
2GB file, this could take quite a while to run.

Unfortunately, there is no HTML element for simply picking a file name.
There are a couple of alternatives:

1. Use the input type=file to have the user browse for the file. On submit,
copy the value from the input type=file element, and put it into a hidden
form field. Then remove it from the input type=file field, so that it
doesn't upload.
2. Write a client-side ActiveX control or Java applet to do this.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Ken" <kf******@hotmail.com> wrote in message
news:uK**************@TK2MSFTNGP10.phx.gbl...
Add this to the HTML designer page

<INPUT id="MyFile" type="file" name="MyFile" runat="server">

Then you can refer to the 'MyFile' object in the code behind.

MyFile.PostedFile.FileName

"Dave56" <no****@co.lane.or.us> wrote in message
news:uw**************@TK2MSFTNGP10.phx.gbl...
Hi.

I know how to use <input type=file runat=server> to upload a file to the
webserver.
However, my files are 2gb and I don't want to up load them.

What I would like to be able to do is to just get the filename of the file the user selected (for example "c:\temp\movie.wmv").
I also want validation that requires the selection of a .wmv file.

What is the best way to do that?

Thanks


Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1865
by: Rodney King | last post by:
Hi, I have developed an ASP page which dynamically displays a list of checkbox options based on a SQL statement. Here is my code: <div style="OVERFLOW:auto; Height: 150px"> <table> <% dim...
20
2437
by: CHIN | last post by:
Hi all.. here s my problem ( maybe some of you saw me on other groups, but i cant find the solution !! ) I have to upload a file to an external site, so, i made a .vbs file , that logins to...
21
18122
by: ryanmhuc | last post by:
I know the subject might be confusing. I am no beginner with javascript but I haven't been able to figure out how to get the javascript file name from code inside the file. So you have an HTML...
3
1384
by: Strange Cat | last post by:
Hi everyone Is it possible to select the contents in an aspnet textbox? (Like the old textbox selectstart and so on properties) Thanx in advance
1
2634
by: Nathan Sokalski | last post by:
When testing a form of mine which uses RequiredFieldValidators that have the Display property set to "Dynamic" the ErrorMessage property is automatically removed when an entry is completely typed...
2
3630
by: areef.islam | last post by:
Hi, I am kinda new to javascript and I am having this problem with selecting multiple options from a select tag. Hope someone can help me out here. here is my code...
3
1344
by: KathyMarriage | last post by:
Hello In days gone by I was a VB programmer but currently tasked to find some answers for a ASP guy. Basically I am wanting to incorporate some of the functionality of the Common Dialog...
0
7227
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,...
0
7331
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,...
1
7054
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...
0
5633
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5056
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...
0
4713
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...
0
3204
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...
0
3188
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
768
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.