cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Hi All

I am trying to upload the a file on to the server , using the following code

*******************

IWDAttributeInfo attInfo = wdContext.getNodeInfo().getAttribute("upload");

IWDModifiableBinaryType binaryType =(IWDModifiableBinaryType) .getModifiableSimpleType();

String filename = binaryType.getFileName();

byte b[] = wdContext.currentContextElement().getUpload();

File path = new File("http://gge.mysap.pg.com:50000/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/www/test.pdf");

try

{

FileOutputStream out = new FileOutputStream(path);

out.write(b);

out.flush();

out.close();

}

catch (FileNotFoundException e)

{

wdComponentAPI.getMessageManager().reportSuccess(e.getMessage());

}

catch (IOException e)

{

wdComponentAPI.getMessageManager().reportSuccess(e.getMessage());

}

*******************

the folder "www" does exist on the specified path.

I get the following message .

"http:/gge.mysap.pg.com:50000/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/www/test.pdf (No such file or directory (errno:2)) "

Am I missing something...

0 Likes
View Entire Topic
Former Member
0 Likes

> Hi All

>

> I am trying to upload the a file on to the server ,

> using the following code

>

> *******************

> IWDAttributeInfo attInfo

> = wdContext.getNodeInfo().getAttribute("upload");

> IWDModifiableBinaryType binaryType

> =(IWDModifiableBinaryType)

> .getModifiableSimpleType();

>

> String filename = binaryType.getFileName();

>

> byte b[] =

> wdContext.currentContextElement().getUpload();

> File path = new

> File("http://gge.mysap.pg.com:50000/irj/servlet/prt/po

> rtal/prtroot/com.sap.km.cm.docs/www/test.pdf");

>

> try

> {

> FileOutputStream out = new

> t = new FileOutputStream(path);

> out.write(b);

> out.flush();

> out.close();

> }

>

> catch (FileNotFoundException e)

> {

> wdComponentAPI.getMessageManager().reportSuccess(e.g

> etMessage());

> }

> catch (IOException e)

> {

> wdComponentAPI.getMessageManager().reportSuccess(e.g

> etMessage());

> }

>

>

> *******************

> the folder "www" does exist on the specified path.

>

> I get the following message .

>

> "http:/gge.mysap.pg.com:50000/irj/servlet/prt/portal/p

> rtroot/com.sap.km.cm.docs/www/test.pdf (No such file

> or directory (errno:2)) "

>

> Am I missing something...

Hello Valery Silaev

Can you gimme an example regarding how can I use java.net.URL and java.net.HttpUrlConnection .

I am trying to upload a file residing on my desktop on to the server.

Regards,