I was able to find the code and have a program ready to parse the
files as soon as I can upload them.  I tried writing my own version of
the code found here:
http://github.com/dpp/liftweb/blob/dcc7b064a42832b06e4523d1a35351967d7a46b2/sites/example/src/main/webapp/file_upload.html
but I got the following error when I tried to load the page on my
browser:

XML Parsing Error: prefix not bound to a namespace
Location: http://localhost:8080/analysis/inprocess
Line Number 78, Column 1:
<choose:post>
^

I am not sure what "choose" is or where to find it and am having
trouble finding documentation online.  I am still working with
Lift-1.0, could this be the problem?

Thanks,
David

On Jun 12, 6:35 am, wapgui <[email protected]> wrote:
> 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 <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to