BBjspWebRequest::getFileUploads (Deprecated)

The BBJSP system is deprecated. For new development, use BBxServlet.

Description

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

Syntax

Return Value

Method

BBjVector

getFileUploads()

Parameters

None.

Return Value

Returns a BBjVector of BBjFileUpload objects

Remarks

The example below demonstrates how a BBjspWebRequest can be used to retrieve the details for all uploaded files.

Example

This example demonstrates how this works in a BBJSP servlet

class public MyServlet

  field private BBjspWebRequest request!
  field private BBjspWebResponse response!
  field private BBjspWebSession session!
  
  method public void service(BBjspServletContext context!)
       
    #request! = context!.getRequest()
    #response! = context!.getResponse()

    resp!.setContentType("text/html")
    s!.write("<html><body><h1>Hello from BBJSP</h1>")
    upload! = #request!.getFileUpload("thefile")
    if upload! <> null() then
      declare BBjFileUpload uploadFile!
      uploadFile! = cast(BBjFileUpload,upload!)
      s!.write("You uploaded '")
      s!.write(uploadFile!.getOriginalName())
      s!.write("' of type:"+ uploadFile!.getContentType())
      s!.write(" and Size:")
      s!.write(uploadFile!.getContentLength())
      s!.write("bytes.<br>")
    else
      s!.write("Please upload a file<br>")
      s!.write("<form id='upload' method='post' action='upload' enctype='multipart/form-data' >")
      s!.write("<input id='thefile' name='thefile' type='file' /><br>")
      s!.write("<input type='submit' value='submit' id='submit' />")
      s!.write("</form>")
    fi
    print(chan)"</body></html>"
    close(chan)
  methodend
classend

See Also

BBJSP

BBjspWebRequest

BBjVector

BBjFileUpload