Connecting Tech Pros Worldwide Help | Site Map

Check whether the unzip folder contains .swf files

  #1  
Old March 24th, 2009, 01:46 PM
Newbie
 
Join Date: Oct 2007
Posts: 19
Hello everyone,
My problem is, i am uploading a zipped file and extracting the contents and saving in a directory.How can i check whether the uploading zipped file contains only .swf files inside, before or after extraction.Please help how can i do this? Its urgent.


Thanks,
amulyab
  #2  
Old March 24th, 2009, 03:15 PM
Expert
 
Join Date: May 2007
Posts: 213

re: Check whether the unzip folder contains .swf files


After extraction, you can read all the filenames in the directory and determine the extensions. For example, use Dir[directory_path] to get the filenames.
  #3  
Old April 10th, 2009, 09:39 AM
Newbie
 
Join Date: Oct 2007
Posts: 19

re: Check whether the unzip folder contains .swf files


Quote:
Originally Posted by improvcornartist View Post
After extraction, you can read all the filenames in the directory and determine the extensions. For example, use Dir[directory_path] to get the filenames.
Thanks.I can get all the filename inside the directory by using Dir[path].But can you tell me please how can i read all the filenames inside and compare it with filename i want and display an error message if it is not present in the directory.Its urgent.
  #4  
Old April 11th, 2009, 05:10 PM
Expert
 
Join Date: May 2007
Posts: 213

re: Check whether the unzip folder contains .swf files


Dir[path] returns an array of filenames, so you should be able to search the array for the filename you want. For instance, you could use Dir[path].include?(filename).
Reply