Pure ASP Upload script with additional features
Source: http://forums.aspfree.com/code-bank-54/pure-asp-upload-script-with-additional-features-94647.html
Hi again everyone,
Im trying to use "Shadow Wizards" Image upload script that can found above...it works great for me except one thing. One section of my form includes checkboxes with the same name (A list of diseases/foods) I need to be able to select multiples of开发者_运维问答 these to insert into the database but it seems with this running I can only get one of the values to submit (the last value clicked).
I've had a quick look on google and I think i've put it down to being because the enctype on the form is "multipart/form-data".
Does anybody (or even Shadow_Wizard himself) know a way round this? If not im going to have to look into another solution for image upload that will allow multiple checkboxes.
the problem is in that Shadowuploader.asp in lines 159-160. there the strElementValue is overwritten in the m_Reuqest Dictionary.
so you have to do it slightly different:
'append to request collection
if m_Request.Exists(strElementName) then
m_Request(strElementName) = m_Request(strElementName) & ", " & strElementValue
else
m_Request(strElementName) = strElementValue
end if
so you have comma seperated values if strElementName already exists in m_Request Dictionary.
If you want you could add some extra intelligence and alter every comma seperated value in the m_request dictionary into an array after the Loop:
dim itm, arr, n
for each itm in m_Request
if instr(m_Request(itm), ", ") > 0 then
arr = split( m_Request(itm), ", ")
m_Request(itm) = arr
end if
next
after uploading you could access the values of checkboxes like this:
objUpload("chk")(1)
as always there is no simple solution when using classic asp...
精彩评论