on 07-12-2006 2:48 AM
Hi. everyone.
I have some question about file upload.
I really wanna upload a csv file(text file),
but as you know,
It is not possible to use FileUpload UI control.
Because the UI element supports binary upload.
How can I upload a csv file and
map the file contents to a Node which has same structure as the csv file.
Plz. help me^^
Hi Etnaya,
You can upload the binary file and then convert it to inputstream and through inputstream you can use to write into the file in the server.Here is the code for this:
Resource : is the attribute of type resource
UploadFile: is value Node under which Resource attribute is present.
IPrivateFileupView.IUploadFileElement element =
wdContext.currentUploadFileElement();
InputStream text = element.getResource().read(false);
File file = new File(element.getResource().getResourceName());
FileOutputStream out = new FileOutputStream(file);
int i=0;
int temp=0;
while((temp=text.read())!=-1)
{
out.write(temp);
}
//This will give you the path where the file is stored
filePath=file.getAbsolutePath();
wdComponentAPI.getMessageManager().reportSuccess("label"+ file.getAbsolutePath());
text.close();
out.flush();
Hope this will help you.
Regards,
Rajeev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
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.