https://domino-ideas.hcltechsw.com/ideas/DDXP-I-431
Wenn ich mehr als eine Datei auswähle, gibt das Steuerelement an, dass mehrere Dateien ausgewählt wurden.
Für das Steuerelement habe ich eine benutzerdefinierte Schaltfläche hinzugefügt Ich habe an eine von Java verwaltete Bean-Klasse gebunden:
Code: Select all
 
Code: Select all
private UploadedFile uploadedFile;
public void save(String parentId, String type, String fields) {
try {
IUploadedFile iUploadedFile = null;
if (null != uploadedFile) {
iUploadedFile = uploadedFile.getUploadedFile();
}
if (null != iUploadedFile) {
attachmentCrud.save(parentId, type, fields, iUploadedFile);
}
} catch (Exception e) {
//
}
}
Code: Select all
@Override
public void save(String parentId, String type, String fields, IUploadedFile iUploadedFile) {
try {
if (null != iUploadedFile) {
Session sess = Factory.getSession(SessionType.CURRENT);
Database db = sess.getDatabase(null, filePath + fileName);
if (null != db) {
if (db.isOpen()) {
String fieldName = null;
//get the original filename
String tempClientFile = iUploadedFile.getClientFileName();
system.print.outline("# iUploadedFile - getClientFileName: " + iUploadedFile.getClientFileName());
system.print.outline("# iUploadedFile - getServerFileName: " + iUploadedFile.getServerFileName());
system.print.outline("# iUploadedFile - getContentType: " + iUploadedFile.getContentType());
system.print.outline("# iUploadedFile - getContentLength: " + iUploadedFile.getContentLength());
//get the "" file (with a cryptic filename)
File tempFile = iUploadedFile.getServerFile();
private UploadedFile uploadedFile;
Dies kann meiner Meinung nach nur ein einzelnes Dateiobjekt darstellen. Und ich kann kein Objekt mit mehreren Dateien in seiner darstellenden Klasse finden:
https://public.dhe.ibm.com/software/dw/ ... pload.html
aber dann das v9-Dokumentation und v12-Option für mehrere Dateien sollten hinzugefügt werden, aber ich kann keine aktuelle Dokumentation dazu finden?
Ich kann jedoch Folgendes aufrufen:
Code: Select all
System.out.println("iUploadedFile.getClientFileNames() = " + iUploadedFile.getClientFileNames());
String[] tmpFiles= iUploadedFile.getClientFileNames();
for (String s: tmpFiles) {
//Do your stuff here
System.out.println(s);
}
Die UploadedFile-Klasse ermöglicht nur das Abrufen einer einzelnen Datei:
Code: Select all
iUploadedFile = uploadedFile.getUploadedFile();
Mobile version