suki2.jpg

« Ubuntu 10.04 first impressions | Main| Jonvon's Post »

Multiple File Upload Identifying Values tip

QuickImage Category Old School Notes Dev
I know this is very old school, but i just needed it for an existing app so this is more an Aid Memuor, also I could not remember where i got it from (someone yell if I've pinched your tip)
Sometimes you have multiple files uploads on a web form, and you want to allocate each file to a specific place or function, i know you can just work out which file is which based on its order in the @AttachmentNames list as per below

image := @AttachmentNames;
@If( @Elements(@AttachmentNames) > 0 ; image[1] ; "" )


but this only works well when the document is not edited all the time (new files added and deleted), personally i prefer an alternative method
First put your file upload and a editable field on your form

FileUpload3.jpg

Set the field as hidden via html properties and give the form an id value the same as its name

FileUpload2.jpg

Now put the following JavaScript in the other html field on the file upload properties

onChange="document.getElementById('SponsorLogo').value = this.value"
(obviously swapping out the elementid to the one you are using)


FileUpload1.jpg

Now you will find that the field contains the value of the field both with JavaScript and notes wise on save
Bookmark and Share

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::lips::rolleyes:;-)

Avalable for on site contract in

 

Hire Me

Directly:

Curriculum Vitae

As a member of:
ldc_badge.gif

Contact My Grubby Hide

Skype Linkin Main Me Twitter

Get LDC Tshirts

All profits go to the Children’s Cancer Association (CCA) in the US.

Social ASW Rating

Enter a URL: