Solved

Using Regular Expression to Validate File in the FileUpload Control

Posted on 2007-03-22
2
226 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 100 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
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.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

617 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