This method is called when an upload of an individulal flie is complete. The filename is passed and you can then decide what to do with the file.

You can override this method to provide custom behavior in a subclass or implement the cOnUploadCompleteFunction() which fires a function with the same signature as this method. One of these typically needs to be implemented in order to do something useful with an uploaded file.

The overridden method should return a result string that is marshalled back to the JavaScript client - very commonly a URL to the uploaded file.

When overridden this method can return a string value that is passed back to the JavaScript client's completion method. Use WriteCompleteResponse() to write out that response.

Note: You can hook this event without subclassing by using FoxPro's BindEvent():


o.OnUploadComplete(lcFileName, loUpload)





*** Implemented as Process class method
FUNCTION OnUploadComplete(lcFilename, loUpload)
LOCAL lcUrl, lcFile

*** Resize the image
lcFile = ADDBS(loUpload.cUploadPath) + lcFileName

*** Delete expired files - only for 10 minutes
DeleteFiles(ADDBS(JUSTPATH(lcFile)) + "*.*",600)

*** We'll return the URL to the image uploaded here
lcUrl = this.ResolveUrl("~/temp/" + lcFileName)

*** Write out the response for the client (if any)
*** In this case the URL to the uploaded image


See also:

Class plUploadHandler

© West Wind Technologies, 1996-2018 • Updated: 03/14/13
Comment or report problem with topic