Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > Other ASP.NET > ASP.NET 1.x and 2.0 Application Design
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 31st, 2005, 02:43 PM
Registered User
 
Join Date: Jan 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Input type=file apply a filter??

I am curious to know if anyone can help me out with applying a filter (only show *.doc || All Files) to the browse dialog that appears. I am able to do it successfully with a windowsapplication, but not sure how to do with a webform. Any help would be awesome. thanks

  #2 (permalink)  
Old January 31st, 2005, 02:47 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Unfortunately, you cannot do that. The <input type="file"> control does not provide this functionality.

What you could do is validate the contents of the input box with JavAscript after the user has selected a file. It's not as good as a file filter, but it least it minimizes the chance someone uploads an incorrect document format.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #3 (permalink)  
Old May 2nd, 2006, 02:10 AM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Actually there is a way to set filter to "Input Type File" just add below Attribute to your "Input type file" and it will work.

accept="image/gif,image/jpeg"

you can add as many options you want as comma separated values

thanks,
Wajhi

  #4 (permalink)  
Old May 24th, 2006, 04:06 AM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by wajhi
Actually there is a way to set filter to "Input Type File" just add below Attribute to your "Input type file" and it will work.
This doesn't seem to work neither in IE or Moz. MSDN says: There is no functionality implemented for this property unless defined by the author.
http://msdn.microsoft.com/library/de...ies/accept.asp

Any suggestions? Here is my ASPX:
<%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="Upload.FileFilters._Default" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
    <title>Default</title>
</head>
<body>
    <form id="Form1" method="post" runat="server">
        <input type="file" id="file1" accept="video/mpeg">
    </form>
</body>
</html>


 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
input type file design in firefox ragu_nit Javascript 3 August 27th, 2007 02:20 PM
input type="file" grstad Classic ASP Basics 24 January 31st, 2007 07:28 PM
INPUT type=file (Urget Help) surendran PHP How-To 1 April 9th, 2006 12:42 PM
input type file darkhalf Javascript 1 October 29th, 2005 02:17 AM
<input type="File"> - Specify File Type and Path gp_mk Classic ASP Basics 2 August 2nd, 2004 03:07 AM



All times are GMT -4. The time now is 05:37 AM.


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