on 12-27-2005 8:09 AM
Hi ,
I am facing a problem while using FileUpload control. It is as follows :
FileUpload control has two properties :
1. FileName
2. FileData
When using the browse button I select a file the contents of upload control include the absolute path to the file (eg, C:\Documents and Settings\i032874\Desktop\Test.rtf ). But when I access the FileName what I get is only the file name Test.rtf.
Now my idea is that directly accesing the upload control element may give me the complete path to the file.
Please do let me know if there are any other options.
Else please tell me how to access a WD UI Element directly (FIleUpload control in this case).
Regards,
Parminder
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Parminder,
When you have created the FileUpload UI element, you would have linked to a value attribute (say "X").
After the user selects the file (say "C:\Folder\Test.txt"), clicks on a button or does some action, in the method just read the context attribute value X.
I tried it, it is giving the full path.
In my case i had a value attribute "FN" directly under the CONTEXT. I linked "FN" to DATA property attribute of FileUpload UI element.
I had a button and FileUpload UI element in my view.
On Click of the button, i read the file name, it gave me full path.
onActionButtonClick(Event)
{
String fileName = wdContext.currentContextElement.
getFN();
// This fileName gave me full path
}
Thanks
Senthil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have modified my answer, just see the answer again.
To test this.. i created a value attribute "FN" directly under the CONTEXT. I linked "FN" to DATA property attribute of FileUpload UI element.
I had a button and FileUpload UI element in my view.
On Click of the button, i read the file name, it gave me full path.
onActionButtonClick(Event)
{
String fileName = wdContext.currentContextElement.
getFN();
// This fileName gave me full path
}
Thanks
Senthil
<b>P.S: Reward Points for useful answer.</b>
Message was edited by: SenthilKumar Radhakrishnan
Hi,
1. Create a value attribute in your view context.
2. Go to corresponding View Layout, select the fileUpload UI element and go to DATA property attribute and select the value attribute (created in view context).
Quick Question, what you planned to do with the full path name or file name ?
Thanks
Senthil
P.S: Reward Points for useful answers.
Hi Parminder,
You can create a value attribute of type binary(or other type) in your view context.
open the layout and FileUpload UI element and you can see the property DATA.There you can bind the context that you just created.
Further you have to use this code in your doInit method
wdContext.getNodeInfo().getAttribute("your-addribute").getModifiableSimpleType();
then in your button action (to trigger the upload).
IWDAttributeInfo attriInfo =wdContext.getNodeInfo().getAttribute("your-attribute");
IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType)attriInfo.getModifiableSimpleType();
String fileName = binaryType.getFileName();
Hi All,
Thanks for all the help. I have tried all the options you gave me but it does not give me the full path it just gives me the file name. I also contacted Web Dynpro team. They said it is not possible for security reasons. Same as Senthivel told.
Once again thanks for the help.
Regards,
Parminder
Hi,
But there is another problem here. I have a dropdown on this view with this FileUpload control. When I select a value in the DropDown the screen refreshes and the FileUpload control does not show the filename anymore although the context mapped to this control still has the file name.
How can I make it show the file name ?
Regards,
Parminder
Hi,
I am creating a component for file upload. In that Visible control file upload and tableview. If I selected file through the browse button in the fileupload UI and i am selecting the some value in table view when i am selecting in tableview the value in the browsed inputfelid get erased.
Is this possible to set the value for that inputfeild through scripts
or any other way to solve this problem?
i am having same kind of problem mentioned above. if u solved can u please guide me.i am developing as portal component.
Helpful answers will appreciable.
Thanks & Regards,
Kathiresan R
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.