BBjHttpRequest::getFileUploads (Deprecated)

BBjHttpRequest::getFileUploads is deprecated for BBj 21.00 and higher, and has been replaced by BBxServletRequest::getFileUploads.

Description

In BBj 14.00 and higher, this method returns a BBjVector of BBjFileUpload objects that have been posted and available in a BBjHttpRequest object.

Syntax

Return Value

Method

BBjVector

getFileUploads()

Parameters

None.

Return Value

Returns aBBjVector.

Remarks

The example below demonstrates how a servlet can retrieve the details for uploaded files.

Example

rem ' Obtain the instance of the BBjAPI object

let myAPI!=BBjAPI()
MyServlet! = new MyServlet()

data!.setCallback(data!.ON_WEB_CONNECTION, myServlet!, "myMethod")

process_events

class public MyServlet
    method public void myMethod(BBjServletEvent p_event!)
        let chan = UNT
        request! = p_event!.getHttpRequest()
        response! = p_event!.getHttpResponse()
        resp!.setContentType("text/html")
        open(chan)"JSERVLET"
        print(chan)"<html><body><h1>Hello BBj!</h1>"
        declare BBjVector files!
        files! = request!.getFileUploads()
        sz = files!.size()
        if (sz) then
            declare BBjFileUpload uploadFile!
            print(chan)"There were " + str(sz) + " files uploaded.<br>"
            for i=0 to sz-1
                uploadFile! = cast(BBjFileUpload,files!.get(i))
                print(chan)"Name:"+ uploadFile!.getOriginalName()
                print(chan)"- as:"+ uploadFile!.getTempName()
                print(chan)"<br>"
            next i
        else
            print(chan)"There were no files uploaded, please upload some:<br>"
        endif
        print(chan)"</body></html>"
        close(chan)
    methodend
classend

See Also

BBjAPI

BBjServletEvent

BBjHttpRequest

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.