Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DSDP - Target Management » How to programmatically upload a file to a remote server? Updated(IFile is not uploaded )
How to programmatically upload a file to a remote server? Updated [message #541448] Mon, 21 June 2010 04:52 Go to next message
Vanessa Ramirez is currently offline Vanessa Ramirez
Messages: 4
Registered: June 2010
Junior Member
Hi everyone,

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);

if(itfIFile.exists())
{

itfIFile.setContents(oIn, 1, monitor);
}
else
{
itfIFile.create(oIn, true, monitor);
}

SystemWorkspaceResourceSet workspaceSet = new SystemWorkspaceResourceSet();
workspaceSet.addResource(itfIFile);

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.

Thanks!

[Updated on: Mon, 28 June 2010 20:12]

Report message to a moderator

Re: How to programmatically upload a file to a remote server? Updated [message #543429 is a reply to message #541448] Tue, 29 June 2010 08:35 Go to previous messageGo to next message
Vanessa Ramirez is currently offline Vanessa Ramirez
Messages: 4
Registered: June 2010
Junior Member
Just as an update the code is correct and the problem was that there was no enough space on disk to create new files Very Happy. However there is no error message that could give me an idea of what was the problem. Thanks!
Re: How to programmatically upload a file to a remote server? Updated [message #583455 is a reply to message #541448] Tue, 29 June 2010 08:35 Go to previous messageGo to next message
Vanessa Ramirez is currently offline Vanessa Ramirez
Messages: 4
Registered: June 2010
Junior Member
Just as an update the code is correct and the problem was that there was no enough space on disk to create new files :d. However there is no error message that could give me an idea of what was the problem. Thanks!
Re: How to programmatically upload a file to a remote server? Updated [message #639511 is a reply to message #583455] Tue, 16 November 2010 13:55 Go to previous message
Martin Oberhuber is currently offline Martin Oberhuber
Messages: 982
Registered: July 2009
Senior Member
Hello Vanessa,

good to hear that you've been succesful.

Could you please file a bug against Target Management, asking for better
error logging in case the remote disk is full? Give as many details as
you can. To file the bug, you can just use this link:

https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Target%2 0Management

Thanks,
Martin
Previous Topic:Enable compression
Next Topic:Unable to view directory structure in FTP
Goto Forum:
  


Current Time: Thu Jul 24 23:43:08 EDT 2014

Powered by FUDForum. Page generated in 0.01972 seconds