Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 24th, 2006, 12:18 AM
Authorized User
 
Join Date: Dec 2005
Posts: 77
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to g_vamsi_krish
Default HtmlInputFile

hai..

    how can i accept only csv files in the HtmlInputFile..
I tried by using

        <input id="filename" ACCEPT="text/csv" name="filename" type="file" runat="server">

but this dosent work.. Is there any other way that i can accept only csv files..

Any help can be Appreciated.

Thanks
Vamsi.


vamsi
__________________
vamsi Krishna G
mobile: 91 + 9986023966.
124 Puttappa layout new Tippasandhra,
bangalore.
Inida
 
Old July 24th, 2006, 09:40 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Yes. In your backend code do something like this:

Dim httpFile as htmlInputFile = filename
Dim strCSV as string = httpFile.PostedFile.FileName

strCSV = strCSV.Substring(strCSV.LastIndexOf("."), (CInt(strCSV.Length) - CInt(strCSV.LastIndexOf("."))))

If strCSV = ".csv" then
 'Process your file here
ElseIf strCSV <> ".csv" then
 'send an alert to the user
End if

Hth

"The one language all programmers understand is profanity."
 
Old July 25th, 2006, 06:40 AM
Authorized User
 
Join Date: Dec 2005
Posts: 77
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to g_vamsi_krish
Default

Thanks for your reply. Your solution helps me a lot.


vamsi Krishna G
mobile: 91 + 9986023966.
124 Puttappa layout new Tippasandhra,
bangalore.
Inida





Similar Threads
Thread Thread Starter Forum Replies Last Post
Change Caption HtmlInputFile but it doest not upl. Israr HTML Code Clinic 1 April 25th, 2008 04:08 AM
HTMLInputFile control geeta HTML Code Clinic 44 January 2nd, 2008 03:29 AM
Change Caption HtmlInputFile Israr ASP.NET 1.0 and 1.1 Professional 4 November 8th, 2006 02:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.