Hi. I'm trying to upload zip files to slide with WebdavResource.
putMethod(String, InputStream). The files are being successfully 
uploaded, but if you get them, they are empty, or they have errors 
(such as "file unexpectedly terminated"). ¿Any help?. Below is my 
code....

Ernesto

public String altaPaquete(String psNombre, FileInputStream poFile) 
throws 
        TPaqueteNoSubidoException {
    if(poFile != null){
        String lsServerRoot = getServerRoot() + ":" + getServerPort() 
+ "/";
        HttpURL loURL = new HttpURL(getServerRoot()+ ":" + 
getServerPort());
        boolean lbExito = false;
        try {
            loURL.setUserInfo(getUserName(),getUserPassword());
            WebdavResource 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 Invocation is like this.....

File coFile = new File("aZipFile.zip");
FileInputStream loStream = new FileInputStream(coFile);
String lsURL = loServer.altaPaquete(coFile.getName(), loStream);

I must use Stream version of the method because this is going to be 
invoked remotely (web browser)
                        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to