I do similar things. First there is a snippet using the bind functionality. var image : FileParamHolder = _
bind("widget", xhtml, "image" -> fileUpload(image = _) } Now write out: val wbos : ByteArrayOutputStream = build(image) val fout = new File(outputFilename) if (fout.exists()) { Log.error("Tried to overwrite existing file") return "Error: Filename already exists" } val foStream = new FileOutputStream(fout) foStream.write(wbos.toByteArray()) foStream.close() def build(image : FileParamHolder) : ByteArrayOutputStream = { val bout = new ByteArrayOutputStream() val zipout : ZipOutputStream = new ZipOutputStream(bout) zipout.setMethod(ZipOutputStream.DEFLATED); zipout.setLevel(Deflater.DEFAULT_COMPRESSION); writeImage(zos, image) } private def writeImage(zos: ZipOutputStream, image:FileParamHolder):Unit = { if (image.fileName == "") { Log.info("Provided image file is null") return } if (image.fileName.lastIndexOf("\\") != -1) //this is needed if upload is from a windows system zos.putNextEntry(new ZipEntry("res/" + image.fileName.substring (image.fileName.lastIndexOf("\\")+1))) else zos.putNextEntry(new ZipEntry("res/" + image.fileName)) zos.write(image.file, 0, image.file.length) //make here a loop on very large files zos.closeEntry() } Cheers Torsten On Jun 11, 10:24 pm, DavidV <david.v.villa...@gmail.com> wrote: > I would like to upload a .csv file onto the web server so I can then > parse it in my webapp, and put certain fields into my database. I > would like a "Browse..." button, much like the one shown on this Lift > example page:http://demo.liftweb.net/file_upload > Can anyone point me in the right direction as to how to get started > doing this, or tell me where I can find the example code for the link > I provided? I can't seem to locate it in liftweb in github > thanks, > David --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---