Do you have a question? Post it now! No Registration Necessary. Now with pictures!
April 15, 2011, 8:52 pm
rate this thread
I have what I thought was gong to be a fairly simple CGI issue.
I have a web form that has either a 'FileUpload" field or a text field
that *should* have a fully qualified URL string. The CGI script will
receive one or the other, not both.
I will know if I have image/video data if the "$CGI->upload()" method
returns something useful. I will know that I have a valid URL if
the value of "$CGI->param('image')" sent through LWP::Simple::head
an array of values.
I want to be a bit cautious as well. I want to limit the SIZE of the
delivered graphic data. I can check that once it is delivered/
I also want to limit the range of allowed MIME types. There are a
huge number of MIME types defined but only a small number of them are
"valid" for rendering in HTML pages.
This is where I am probably starting to reinvent the wheel.
LWP::Simple::head will tell me the "content-type" of the item and
the "$CGI->upload()" also returns content-type info. What I am not
instantly seeing is a list of "valid" HTML display types.
Does such a thing exist in Perl module form? I have seen posts here
where folks hard-code the allowed list into a Perl structure. Is that
the best/only way?
- » FAQ 4.58 How do I look up a hash element by value?
- — Next thread in » PERL Discussions