cancel
Showing results for 
Search instead for 
Did you mean: 

how to read the data of a file using upload option....

Former Member
0 Kudos

Hi Frndz..

As per my requirment , i need to provide a upload UI to the user , so he can select file to be upload whenever user select the file n clicks on upload button i need to read the data of that fiel that user selects.

I have a solutions for this in JSP/JAVA , but i was unable to handle this in web dynpro..c this link in jsp ..

http://www.roseindia.net/jsp/fileupload.shtml

Thanks in Advance..

Regards

Rajesh

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

You can refer to the following How to guides (upload of files)

Regards

Pankaj Prasoon

Former Member
0 Kudos

Hi,

Create a Value attribute (resource) of type Resource, bind it with the property of File Upload UI element.

On action place the code and Deploy the application


byte[] bytes = new byte[ 1024];

FileOutputStream out = new FileOutputStream( new File( <path in server>));
InputStream in = resource.read( true);
int len;
while( ( len = in.read( bytes)) > 0)
{
	out.write( bytes, 0, len);
}
in.close();
out.close();

Regards

Vinod V

Former Member
0 Kudos

Hi Vinod..

Thnaks for ur prompt reply,but my requirment is not to read the file @ server, as per my requirment we have to provide a upload UI to user ,so user can selects a file on his machine(means @ client mechine), so i need to read the file which he selects n pass these data to RFC.

In jsp/java we can catch a selecte file like this

"String contentType = request.getContentType();

DataInputStream in = new DataInputStream(request.getInputStream());"

how it could be in WDP

Regards

Rajesh

Former Member
0 Kudos

Once you use the Upload UI element and bind the Resource property with an value attribute of type Resource, During execution it prompt for select file wizard and on selection of a file, it gets as a resource. Make use of this Resource on a button action to store in server side.

Whats the use of RFC here and its Type of parameter in your application?

Regards

Vinod V

Former Member
0 Kudos

Ok Vinod,ya ur right... but my aim is not to store the selected file on server .. i need to read the data from that file send the data to RFC to store on DB.

Regards

Rajesh

Former Member
0 Kudos

Hi,

Once the data is available in the context call the respective rfc with the data that is available as part of the Resource.

Regards

Ayyapparaj

Former Member
0 Kudos

Please tell me the argument type of RFC. Read the Resource in to respective type and pass that to RFC method.

Regards

Vinod V