I'm having troubles to upload files from a client's machine to Slide server. Locally (from the server), using WebdavResource.putMethod (String, File). There was no problem, but, remotely, using WebdavResource.putMethod(String, InputStream) it didn`t work. In a particular case, uploaded zip files are empty, or have an "unexpected end of file reached". Any help?
Here is my code.... public String altaPaquete(String psNombre, InputStream poFile) throws TPaqueteNoSubidoException { if(poFile != null){ String lsServerRoot = getServerRoot() + ":" + getServerPort() + "/"; HttpURL loURL = new HttpURL(getServerRoot()+ ":" + getServerPort()); boolean lbExito = false; WebdavResource loRemoteFile = null; try { loURL.setUserInfo(getUserName(),getUserPassword()); loRemoteFile = new WebdavResource(loURL); lbExito = loRemoteFile.putMethod(getServerPath() + psNombre, poFile); loRemoteFile.close(); } catch (MalformedURLException e) { throw new TPaqueteNoSubidoException("URL mal formada", e); } catch (HttpException e) { throw new TPaqueteNoSubidoException(e); } catch (IOException e) { throw new TPaqueteNoSubidoException(e); } if(lbExito){ return lsServerRoot + getServerPath() + psNombre; } else { throw new TPaqueteNoSubidoException("No se pudo guardar el archivo"); } } else { throw new TPaqueteNoSubidoException("No se puede leer el archivo"); } } ... and the invocation public void testAltaPaquete(){ try{ File fn = new File("c:\\Test.zip"); FileInputStream loStream = new FileInputStream(fn); AccesoPaquetes loServer = new AccesoPaquetes( SERVER_ROOT, SERVER_PORT, SERVER_PATH, USER_NAME, USER_PASS ); String lsURLEsperada = SERVER_ROOT + ":8080/" + SERVER_PATH + coFile.getName(); String lsURL = loServer.altaPaquete(fn.getName(), loStream); assertTrue(lsURLEsperada.equals(lsURL)); } catch (TPaqueteNoSubidoException ex){ fail(ex.getMessage()); } catch (FileNotFoundException ex) { fail("Archivo no encontrado"); } } This ends succesfully, with no fail. Thanks a lot, Ernesto --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]