Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using Regular Expression to Validate File in the FileUpload Control

Posted on 2007-03-22
2
Medium Priority
?
228 Views
Last Modified: 2010-04-16
Hello and how is it? Quick question and sorry to bother everyone with this, but I am not finding on the Web what I am looking for. I am using the FileUpload control and I want to make sure the user is going pick a certain file. For example the file maybe File34455_349943 or TextFile498595_93493. There is no extensions so cannot match by the extension. I just want to make sure they are picking files with "File" in the filename. I could care less what else is apart of the filename. I am not sure of the regular expression to use because of the path of the file being inserted into the text box. Thanks :)
0
Comment
Question by:Corey_819
[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 1

Accepted Solution

by:
bennyshoham earned 400 total points
ID: 18771669
Split the filename with the path into an array using string.Split function and "\" as delimiter.
Use the regular expression on the last cell in the array to check if it consist of the word "file".
0
 
LVL 1

Author Comment

by:Corey_819
ID: 18771832
Thanks bennyshohman, I was making this way more complicated then it needed to be. Thanks for your help that worked. ;:)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
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: …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

664 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