cancel
Showing results for 
Search instead for 
Did you mean: 

write file on the server linux

Former Member
0 Kudos

Hi

i have created a web dynpro project that create a PDF file by use 3 RFC.

In the end I have this file on my desktop.

I need to write this file in a specific server location.

THis location will use by me to attach the file on my view that containing the Ifrane object.

Plese hel me

Accepted Solutions (1)

Accepted Solutions (1)

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

Use file upload ui element.

Create an attribute upload.

Click the browse button and give the path of the PDF file

Write this code in any action event handler

IWDAttributeInfo attInfo =

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

IWDModifiableBinaryType binaryType =

(IWDModifiableBinaryType) attInfo.getModifiableSimpleType();

filename = binaryType.getFileName();

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

File path =new File("

<serverpath>"+filename );

try {

FileOutputStream out = new FileOutputStream(path);

out.write(b);

out.close();

} catch (FileNotFoundException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

Regards,

Vijayakhanna Raman

Former Member
0 Kudos

I have an error on:

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

The Attribute Upload is a string????

is empty???

thanks

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

Change the attribute type to binary.

Regards,

Vijayakhanna Raman

Answers (0)