Re: validation for file
by 7stud -- other posts by this author
May 8 2008 11:39PM messages near this date
validation for file
|
Re: validation for file
Sunny Bogawat wrote:
> i am developing one application in which user uploaded one csv template
> to my system(file). but we have to take care that user should uploaded
> .csv file only if he trying to upload another file we have to restrict
> it.
> how to check for extention in ruby on rails
>
Does this forum say "ruby on rails" anywhere? Or is it your
understanding that any forum that contains the words "ruby" or "rails"
could not possibly be related to precious gems or trains.
In the Ruby programming language, which is what this forum is about, you
could do something like this:
fnames = ["somefile.csv", "anotherfile.jpg"]
fnames.each do |fname|
pieces = fname.split(".")
if pieces[-1] != "csv"
print "bad file: ", fname
puts
end
end
--
Posted via http://www.ruby-forum.com/.
Thread:
Sunny Bogawat
7stud --
Robert Klemme
|