Liftweb provides AJAX functionality for all html elements except file upload using Scala .
But there is a way to upload file using AJAX by binding form as AJAX form .
1) add below lines in your html .
<div class="lift:FileSnippet.uploadFile"> Upload File : <input name="upload" type="file"></input> <input type="submit" name="submit" value="Upload"/> </div>
2)
class FileSnippet {
def uploadFile(form: NodeSeq): NodeSeq = {
def handleFile():JsCmd = {
// Add Your JavaScript Code
}
var fileHolder: Box[FileParamHolder] = Empty
val bindForm =
"type=file" #> SHtml.fileUpload((fph) => fileHolder = Full(fph)) &
"type=submit" #> SHtml.ajaxSubmit("Submit", handleFile _)
SHtml.ajaxForm(
bindForm(form))
}
}
You will get file element in fileHolder variable . In handleFile() , write your file functionality code .






How is it different from others???