file upload through wiki page

LabKey Support Forum (Inactive)
file upload through wiki page martin  2014-11-26 04:42
Status: Closed
 
hi, i'm trying to create a wiki page with <input type="file"> element for a user to upload selected file from their computer.

is there a simple way to pass this file (through insertRows() or something else javascript) to a list with Attachment field type?

thank you

martin
 
 
jeckels responded:  2014-11-26 13:12
Hi Martin,

File upload is a tricky thing to coordinate with AJAX-style requests to the server. LABKEY.Query.insertRows() can't upload a file. It does allow you to point to files which have already been uploaded, which is the "File" type. The "Attachment" type, which is what lists use, stores the file as a BLOB in the database, and can't simply point to it on the file system.

I think the easiest approach here would be to go to the default insert view for your list and look at the <form> that it generates. You could target the same URL in your <form>, and create <input> elements that match as well.

Thanks,
Josh