By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,038 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

How to validate a file name across record set?

P: 1
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
Share this Question
Share on Google+
1 Reply


P: 11
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

Post your reply

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