String sFileServer = Environment.getProfileVar(sProfile, "fileserver", "localhost");
String sWrkAHome = sStorage + "domains" + File.separator + iDom.toString() + File.separator + "workareas" + File.separator + getString(DB.gu_workarea) + File.separator;
if (DebugFile.trace) DebugFile.writeln("workarea home = "+sWrkAHome);
Product oProd = new Product();
oProd.put(DB.nm_product,Gadgets.left(sFileName, 128));
oProd.put(DB.gu_owner, sGuWriter);
oProd.put(DB.dt_uploaded, dtNow);
if (sDescription!=null) oProd.put(DB.de_product, Gadgets.left(sDescription,254));
oProd.store(oConn);
ProductLocation oLoca = new ProductLocation();
oLoca.put(DB.gu_owner, sGuWriter);
oLoca.put(DB.gu_product, oProd.get(DB.gu_product));
oLoca.put(DB.dt_uploaded, dtNow);
oLoca.setPath (sFileProtocol, sFileServer, sWrkAHome + sCatPath, sFileName, sFileName);
oLoca.setLength(oFile.length());
oLoca.replace(DB.id_cont_type, oLoca.getContainerType());
oLoca.store(oConn);
if (sFileProtocol.equalsIgnoreCase("ftp://"))
oLoca.upload(oConn, oFileSys, "file://" + sDirPath, sFileName, "ftp://" + sFileServer + sWrkAHome + sCatPath, sFileName);
else
oLoca.upload(oConn, oFileSys, "file://" + sDirPath, sFileName, sFileProtocol + sWrkAHome + sCatPath, sFileName);
ActivityAttachment oAttach = new ActivityAttachment();
oAttach.put(DB.gu_activity, getString(DB.gu_activity));
oAttach.put(DB.gu_product, oProd.getString(DB.gu_product));
oAttach.put(DB.gu_location, oLoca.getString(DB.gu_location));
oAttach.put(DB.gu_writer, sGuWriter);
oAttach.store(oConn);
if (bDeleteOriginalFile) {