RSS feed for blog Linkin Skype Mail Me Twitter

Stickfight

Multiple File Upload Identifying Values tip

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

Leave Your Comments

blog comments powered by Disqus
Latest Blogs