on 03-15-2006 12:22 PM
Hi
I am Trying to Upoad a File From Client to Server.
For this i am using FileUpload UI element in the WebDynpro.
I want to know the process.Please send the Process
What do you mean by process?
Usage of FileUploadUI control:
1. create a FileUploadUI element in your layout
2. create a context value attribute of type binary
3. make the binary attribute modifiable (in wdInit of the view controller)
4. create a button to trigger the upload from the ui
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> IWDAttributeInfo attInfo =
> wdContext.nodeRoot().getNodeInfo().getAttribute("FileU
> pload");
>
> //binaryType = (IWDModifiableBinaryType)
> attInfo.getModifiableSimpleType();
you get a classcastexception, right? Replace IWDModifiableBinaryType with ISimpleTypeModifiable in your second statement.
For context access better use the automatically generated static constants instead of hardcoded strings.
Hi Somaraja,
For doing so just follow these steps:
<i>1) Create a attribute in the context of your view of type <u>Resource</u> (This will hold the value of the file you have selected) from your local System.
2) After that create a button with a action of say onUpload.
3) In code implementation of this onUpload function get the insatance of this resource object and get the value of the resouce in inputstream.
4) Put this inputStream object in a file and that will be uploaded at the server side.</i>
I am also attaching a code snippet for your better understanding.
IPrivateFirst.IUploadFileElement element = wdContext.currentUploadFileElement();
InputStream text=null;
int temp=0;
try {
// If a file in the FileUpload field exists
File file = new File(element.getFileName().getResourceName());
FileOutputStream out = new FileOutputStream(file);
if (element.getFileName() != null) {
text = element.getFileName().read(false);
while((temp=text.read())!=-1)
{
out.write(temp);
}
}
out.flush();
out.close();
}
catch (IOException e2)
{
e2.printStackTrace();
}
I hope this will solve the problem. Actually the error you are getting is because of the filetype you have selected. The Upload UI Element accepts the Resource as its Element type.
If any other information required then please let me know.
Regards
Pravesh
PS: Please consider rewarding points if helpful and solved.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.