Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9031985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:52:11+00:00 2026-06-16T07:52:11+00:00

I want to implement an image uplad with Lift. Started with this . I’m

  • 0

I want to implement an image uplad with Lift. Started with this. I’m new to Lift.

I made some modifications. For now I just want to see something working. Not necessarily the images. So far I have:

package code 
package snippet 
import net.liftweb.http.S
import net.liftweb.common.Full
import net.liftweb.common.Empty
import net.liftweb.common.Box
import net.liftweb.http.FileParamHolder
import net.liftweb.util._
import Helpers._
import scala.xml.Group
import scala.xml.NodeSeq
import net.liftweb.http.SHtml

class AddEntry {

  // Add a variable to hold the FileParamHolder on submission
  var fileHolder : Box[FileParamHolder] = Empty

  def doTagsAndSubmit (t : String) {

//    val e : Expense = ...
    // Add the optional receipt if it’s the correct type
    val receiptOk = fileHolder match {
      // An empty upload gets reported with a null mime type,
      // so we need to handle this special case
      case Full(FileParamHolder(_, null, _, _)) => true

      case Full(FileParamHolder(_, mime, _, data))
        if mime.startsWith("image/") => {
//          e.receipt(data).receiptMime(mime)
          true
        }

      case Full(_) => {
        S.error("Invalid receipt attachment")
        false
      }

      case _ => true
    }

//    (e.validate, receiptOk) match {
//    }
}

  def addEntry(content: NodeSeq): NodeSeq = {

      bind("prefix", content,
              "receipt" -> SHtml.fileUpload(fileHolder = _)) //compiler error: type mismatch; found : net.liftweb.http.FileParamHolder required: net.liftweb.common.Box[net.liftweb.http.FileParamHolder]
  }
}

The html:

<lift:AddEntry.addEntry form="POST" multipart="true">
    <td>Receipt (JPEG or PNG)</td>
<td><prefix:receipt /></td>
</lift:AddEntry.addEntry>

As commented in the code I get in "receipt" -> SHtml.fileUpload(fileHolder = _) a compiler error: error: type mismatch; found : net.liftweb.http.FileParamHolder required: net.liftweb.common.Box[net.liftweb.http.FileParamHolder]

Don’t understand it, because fileHolder is of type Box[FileParamHolder]. It should be related with the expression fileHolder = _, but don’t know how.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T07:52:12+00:00Added an answer on June 16, 2026 at 7:52 am

    From the API it seems that SHtml.fileUpload provides a FileParamHolder but your variable fileHolder is of type Box[FileParamHolder], so setting those two does not work out of the box.

    If you try this:

    SHtml.fileUpload(f => fileHolder = Box !! f))
    

    It will provide you with a Box[FileParamHolder] and that should allow you to compile your code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I implement glow like in http://http.developer.nvidia.com/GPUGems/gpugems_ch21.html And now i want to implement after image
I want to implement this image area textbox1 and textbox2 ninepatch able how can
I want to implement some image-processing algorithms which are intended to run on a
I want to implement this image area textview 1 to textview 9 ninepatch able
i starter in jqgrid, i want implement inline edit in jqgrid i have this
given this class definition: public class Frame { IFrameStream CapturedFrom; } I want implement
I want to implement a simple script to do some boring housekeeping on my
I want to implement a RSA algorithm to encrypt an image ( byte[] ).
Im working on an image sharing site and want to implement tagging for the
I want to implement a floating image that would scroll up/down when the user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.