|How to programmatically upload a file to a remote server? Updated [message #541448]
||Mon, 21 June 2010 08:52
| Vanessa Ramirez
Registered: June 2010
This is my first post and I am not sure if this is a proper question for this forum. However, I will give it a shot and hopefully someone can lead me to the right direction.
I am developing a plugin which uses RSE. One of the things I want to do is to upload a file to a remote system. What I was trying to do is to create a temporary file locally and upload it to the remote system.
I am using Helios and TM 3.2. When I call upload, it does not copy the source content to the new file and no exception is thrown. However the file is created remotely but empty.
The code is the following:
InputStream oIn = new ByteArrayInputStream(content.getBytes());
IFile itfIFile = resources.getFile(filename);
itfIFile.setContents(oIn, 1, monitor);
itfIFile.create(oIn, true, monitor);
SystemWorkspaceResourceSet workspaceSet = new SystemWorkspaceResourceSet();
final IRemoteFile parentFolder = targetFile.getParentRemoteFile();
SystemRemoteResourceSet resourceSet = UniversalFileTransferUtility.uploadResourcesFromWorkspace(wo rkspaceSet, parentFolder, monitor, true);
This is tested in a local connection and ssh connection.
Any guidance would be greatly appreciated.
[Updated on: Tue, 29 June 2010 00:12]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.02021 seconds