473,382 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

How to validate a file name across record set?

Hi,

I am working on a file uploader. Everything is working as intended, however I need to do some file validation on it across a database.

I got the database to open the connection and get the values in a recordset, however I cannot take the filename that I choose to upload to find the name against the recordset.

Expand|Select|Wrap|Line Numbers
  1.         function CuteWebUI_AjaxUploader_OnSelect(files) {
  2.                 <%
  3.                 Set AdoCon=Server.CreateObject("ADODB.Connection")
  4.                 Set AdoRec=Server.CreateObject("ADODB.Recordset")
  5.                 AdoCon.ConnectionString="Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Password=******;Initial Catalog=AFDDB_DEVY;Data Source=MOMENTUMTEST"
  6.                 AdoCon.Open
  7.                 AdoRec.Open "Select Custid from APPLICATION",AdoCon
  8.                 str=AdoRec.GetString()
  9.                 %>
  10.  
  11.                 for (var i = 0; i < files.length; i++) { 
  12.                 var name = files[i].FileName; 
  13.                 if (str!=name) { 
  14.                     files[i].Cancel();
  15.                     } 
  16.                 }  
  17.  
  18.                 <%
  19.                 AdoRec.close
  20.                 AdoCon.close
  21.                 set AdoRec = Nothing
  22.                 set AdoCon = Nothing
  23.                 %>        
  24.             }

Can someone help me how to validate the file name that the user chooses against the recordset?

Thanks,
Khan
Dec 19 '12 #1
1 1868
Use this Function

Expand|Select|Wrap|Line Numbers
  1. public function getFileVal()
  2.     dim files, file_name, array_path
  3.     file_name = "This Is The Path Recieved When User Uploads"
  4.     array_path = split(file_name,"\")
  5.     file_name = array_path(ubound(array_path)) 'Here You Are Reading File Name
  6.     getFileVal = file_name ' Here We Get The File Name From Path
  7. end function 
  8.  
Loop this Using While and Compare getFileVal and Your File Name From RecordSet
Apr 6 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Luke Airig | last post by:
I am using the Saxon 6.5.3 engine and I have an xsl stylesheet that merges two files on a date_time field and writes out a tab-delimited flat file. My working version has a hard-coded file name in...
1
by: JonChart | last post by:
Hi all, I would like to know ho to validate a file name when uploading via asp and whether or not this can be validated with javascript? I need to upload 2 images and the file names must be...
6
by: Allen | last post by:
Hi, I want to retrieve the selected folder and entered file name from the SaveFilsDialog. The user is able to create or selected a different folder during the dialog displayed. If user enters...
1
by: Gaetan | last post by:
I have a web application where the user can type the name of a file name in a field. I want to make sure the syntax of that filename is valid before using it. I browsed the methods in various...
3
by: sheeeng | last post by:
Hi all, I know that we can check for invalid file name characters as shown at http://www.codeproject.com/useritems/reallyusefulpath.asp. But how can we check a string for invalid file name...
2
by: harry | last post by:
I need to validate a file name but it has to work on Windows & Unix! Does anybody know of java code that does this? thanks in advance harry
185
by: jacob navia | last post by:
Hi We are rewriting the libc for the 64 bit version of lcc-win and we have added a new field in the FILE structure: char *FileName; fopen() will save the file name and an accessor function will...
3
by: laredotornado | last post by:
Hi, Can anyone provide a function that can validate if a string would pass as a valid Unix (specifically Fedora Core 8 Linux) file name? For example, I'm fairly certain one of the rules is that...
4
by: liberty1 | last post by:
Hi everyone. I appreciate your effort at helping newbies like me. I have the following problems and will appreciate urgent help. PROBLEM NUMBER 1: Using PHP and MySQL, I am able to upload...
0
by: WillChapman | last post by:
Hello charitable, I have a repetitive task that requires the user to go to a command prompt, navigate to a folder (usually deep in the system), and perform a syntax scan on a file (with an in-house...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.