Home
TeamSite
Uploading File in teamsite
yintide
Hi Guys,
I am downloading a file from Teamsite onto my local drive and after modifying the file (adding some XML tags or removing some tags) I write that file to Teamsite. When I download this file , from teamsite again . I see the file is not modified correctly.
What could be the problem I am using CSSimpleFile.write() method to write contents into this file.
File file = new File("/temp/text");
FileOutputStream fo = new FileOutputStream(file);
fo.write(XMLHelper.toString(doc).getBytes());
fo.close();
// Read the modified file into Stream again
int fileSize = (int)f.length();
byte[] data = new byte[fileSize];
DataInputStream in = new DataInputStream(new FileInputStream(f));
in.readFully(data);
in.close();
long offset =0;
CSSimpleFile simpleFile = (CSSimpleFile)targetFile;
simpleFile.write(data, offset, data.length, true);
Can somebody tell me how to modify the file from teamsite, Should I download the file or should I modify the file on the fly
Thanks
Deepak
Find more posts tagged with
Comments
msrinivas
Are you trying to edit it from the UI or from the mount point? O/S? TS version?
yintide
I am using CSSDK classes to download the file .
I create CSClient, then create CSvPath and from that I create CSSimpleFile. I have used the sample example which was given in Teamsite cook book
Made some little changes to that.
Migrateduser
I am not sure if you can modify the file on fly. But you can download the file to a temporary location, modify the file and upload it.
After going though the code you posted are first reading the original file even before modifying it. Once you modified you need to flush the data back to the server and then read it to check if the file is modified or not.