?
Solved

Regular Expression For uploading Doc, RTF, and Txt files

Posted on 2006-11-22
2
Medium Priority
?
571 Views
Last Modified: 2012-06-27
I have an upload form that needs to upload resumes. I only want to accept the following file types.

rtf, doc, txt and if possible provide a seperate error if the member trys to upload a .docx file.

The docx file is due to MS new Word 2007 I know not too many people have it now but by time I get this site completed it will be more prominate.

 

So anyhow the overall question is what would the regularexpression be for this?
0
Comment
Question by:Scripter25
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17998728
Here is a VB.NET example without using regular expressions:

Imports System.IO

...

        Dim fileName As String = Environment.GetFolderPath(Environment.SpecialFolder.Personal) & "\Document1.doc"
        Dim info As New FileInfo(fileName)
        Dim ext As String = info.Extension.ToLower()
        If ext = "doc" OrElse ext = "rtf" OrElse ext = "txt" Then

        End If

Bob
0
 
LVL 6

Accepted Solution

by:
badalpatel earned 2000 total points
ID: 18001074
this is the RE for checking doc,rtf,txt format..

<asp:RegularExpressionValidator ID="RegularExpressionValidator8" runat="server" ControlToValidate="FU_Image"
                            ErrorMessage="Invalid File Type" Font-Names="Verdana" Font-Size="XX-Small" ValidationExpression="^([a-zA-Z]\:|\\)\\([^\\]+\\)*[^\/:*?'<;>;|]+\.(doc|rtf|txt)(l)?$"></asp:RegularExpressionValidator>
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question