cancel
Showing results for 
Search instead for 
Did you mean: 

HI Masters , I need information for file upload program in web dynpro java

Former Member
0 Kudos

Hi masters,

i need some inforamtion and documentation on file upload program in web dynpro java

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

hi!

please follow the following link.

don`t forget to take a resource of type com.sap.ide.webdynpro.uielementdefinitions.Resource ,

which is used to load a file into your context.

thanks

vishal

Former Member
0 Kudos

Hi surya,

You can follow this procedure to upload the file

i) Take One Context Attribute named as "D1" of Type "binary".

ii) Take one FileUpload UI Element in the Layout Tab.

iii) Bind FileUpload UI Element's data Property to the taken Context Attribute. Here it is "D1".

iv) Take one Button UI Element in the Layout Tab named "Upload" and in the Action of that Button write the following Code.

v) The following code Generates one Folder in the Server & inside that Folder given file is Uploaded.

File ff=new File("FolderXYZ"); // Creates One Folder with the given Name ( Here Folder name is "FolderXYZ")

ff.mkdir();

try

{

byte b[]=null;

IWDAttributeInfo objAttinfo=null;

IWDModifiableBinaryType binType=null;

File f=null;

FileOutputStream fos=null;

if(wdContext.currentContextElement().getD1()!=null)

{

b=wdContext.currentContextElement().getD1();

objAttinfo=wdContext.getNodeInfo().getAttribute(IPrivateAttachView.IContextElement.D1);

binType=(IWDModifiableBinaryType)objAttinfo.getModifiableSimpleType();

f=new File(ff.getName()+"

"+binType.getFileName());

fos=new FileOutputStream(f);

fos.write(b);

fos.flush();

fos.close();

}

objMessageManager.reportSuccess("File uploaded to server");

} catch (Exception e)

{

objMessageManager.reportException("Unable to upload file to server, error is:"+e,false);

return;

}

The Uploaded file is stored in the folder & that folder is stored in the Server's following Path.

<Your Server>\c$\usr\sap\J2E\JC00\j2ee\cluster\server0

You can access your Uploaded file from the following Path

<Your Server>\c$\usr\sap\J2E\JC00\j2ee\cluster\server0\FolderXYZ

Regards

Sagar Ingalwar

Former Member
0 Kudos

Hello,

I know this topic is old but i'm currently developping the same kind of solution on an old version with Netweaver Developer Studio Version 2.0.19 (I can't use a more recent one because the Portal is also on old one).

So my question was, is it possible to save on onther place than the path usr\sap\J2E\... ?

I wonderred if i could save it on a netword drive or any other location.


Thanks for your help

Regards,


Thomas

Former Member
0 Kudos

Hi Surya,

follow the link,

Regards

Sreedhar.

Former Member
0 Kudos