if (imageData!=null && fileName!=null) {
String fileType = "-1";
-
+
//the where clause to find the media_type entry
//from the content-type.
- //we use the media type entry to lookup the
+ //we use the media type entry to lookup the
//media Handler/Storage classes
String wc = " mime_type='"+contentType+"'";
String mediaTypeId = null;
String mediaStorageName = null;
String mediaHandlerName = null;
-
+
//if we found an entry matching the
//content-type int the table.
if (mediaTypesList.size() > 0) {
mediaStorageName = mediaTypesList.elementAt(0).getValue("tablename");
mediaHandlerName = mediaTypesList.elementAt(0).getValue("classname");
parameters.put("to_media_type",mediaTypeId);
-
+
//load the classes via reflection
String MediaId;
try {
//were done with mpReq at this point, dereference it. as it contains
//mucho mem. -mh 01.10.2001
mpReq=null;
-
+
if(mediaId!=null){
new ProducerMedia().handle(null, null, false, false, mediaId);
}
} //end try-catch
- if (fileType != "-1")
+ if (!fileType.equals("-1"))
entImage.setImage(imageData, fileType);
else
theLog.printError("Wrong file uploaded!");
try {
WebdbMultipartRequest mp = new WebdbMultipartRequest(req);
HashMap parameters = mp.getParameters();
- MpRequest mpReq = (MpRequest)mp.requestList.get(0);
- byte[] imageData=mpReq.getMedia();
- String fileName=mpReq.getFilename();
- String contentType=mpReq.getContentType();
+ //MpRequest mpReq = (MpRequest)mp.requestList.get(0);
+ //byte[] imageData=mpReq.getMedia();
+ //String fileName=mpReq.getFilename();
+ //String contentType=mpReq.getContentType();
EntityUsers user = _getUser(req);
parameters.put("to_publisher", user.getId());
parameters.put("is_published","0");
String id = mainModule.set(parameters);
- EntityImages entImage = (EntityImages)mainModule.getById(id);
-
- if (imageData!=null && fileName!=null) {
- String fileType = "-1";
- if (contentType.equals("image/jpeg")) fileType="0";
- if (contentType.equals("image/gif")) fileType="1";
- if (fileType != "-1")
- entImage.setImage(imageData, fileType);
- else
- theLog.printError("Wrong file uploaded!");
- }
+ theLog.printError("Image ID"+id);
_edit(id, req, res);
}
catch (IOException e) { throw new ServletModuleException("upload -- ioexception " + e.toString());}
String fileType = "-1";
if (contentType.equals("image/jpeg")) fileType="0";
if (contentType.equals("image/gif")) fileType="1";
- if (fileType != "-1") {
+ if (!fileType.equals("-1")) {
EntityImages entImage = (EntityImages)mainModule.getById(idParam);
entImage.setImage(imageData, fileType);
}
}
catch (IOException e) { throw new ServletModuleException("upload -- ioexception " + e.toString());}
catch (ModuleException e) { throw new ServletModuleException("upload -- moduleexception " + e.toString());}
+ catch (StorageObjectException e) { throw new ServletModuleException("upload -- storageobjectexception " + e.toString());}
}
else // keine id
throw new ServletModuleException("Keine id angegeben");