HandyCache форум

Главная категория => English forum => Тема начата: pankaj17939 от 24 мая 2013, 15:29:03



Название: Content-Type error
Отправлено: pankaj17939 от 24 мая 2013, 15:29:03
I am filtering file by content and size
file in png 
http://lh4.googleusercontent.com/-q-oA6hx8VHQ/UZ9HQMu0T1I/AAAAAAADGHY/hldOlONJWTw/w506-h382-o/020-.png


Script  Start

 -- Check  for the Content-Type
function GetContentType(s)
  _,_,x = string.find(s, '[cC]ontent%-ype: *([^;\r\n]+)')
  if x~=nil then x = string.lower(x) end
  return x
end

-- Store Content-Type in variable
 type = GetContentType(hc.answer_header)

 -- Check 'Content-Type' is 'png' and storing it in variable png
 if type~=nil then png = string.find(type,'image/png',1,true)
  else png = nil end

Script end

the variable is always nill even if png file is browsed

Pls guide for the script