1. JSONObject MaeDriveDao.setTempFileAsFinal(request, "file")
Transforms a file sent by the file upload widget into a system file. The second parameter corresponds to the name of the variable that stores the information of the file uploaded by the user
example:
if(archivo != null){
jsonFile = MaeDriveDao.setTempFileAsFinal(request, "archivo");
archivo = jsonFile.getInt("fileid");
}
the third line of the previous example shows how to get the fileId that has been uploaded to the system
2. Boolean MaeDriveDao.isTempFile(HttpServletRequest request, String fileVarName)
Evaluates whether the value of the variable sent by the user via the upload file widget corresponds to a new file uploaded by the user (true) or a previously uploaded file (false). This is used to know if it is a new file or if it is replacing an existing one. example:
if(MaeDriveDao.isTempFile(request, "archivo")){
jsonFile = MaeDriveDao.setTempFileAsFinal(request, "archivo");
archivo = jsonFile.getInt("fileid");
lastFileId = MaeDriveDao.getLastFileId(request, "archivo");
fileAccess.deleteFile(lastFileId);
}
The if evaluates if it is a new file; if that is the case then it gets the new fileid
and proceeds to remove the old file from the OS
3. Integer MaeDriveDao.getLastFileId(request, String fileVarName)
Gets the Id of the file before it was replaced in the file upload widget
4. JSONObject MaeDriveDao.setPerms(Integer fileId, String role)
Set access permissions for the file according to a role
5. JSONObject MaeDriveDao.setPerms(Integer fileId, Integer userId)
Set file access permissions for a user
6. JSONObject MaeDriveDao.setSitePerms(Integer fileId, String site)
Set file access permissions for a domain/site
7. void fileAccess.deleteFile(Integer fileId)
Delete a file uploaded to the server given its Id
8. JSONObject MaeDriveDao.uploadTempFileAndParameters(HttpServletRequest request)
Upload files temporarily together with the parameters that have been sent in the request. The result of this operation is a JSONObject
object with the parameters sent in the request and a list of file handles to save later permanently (the list of file handles is a JSONArray
object called filelist)
created with
HTML Designer .