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...
Request clarification before answering.
> 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,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.