Thanks Ernesto for the reply,
yes I can create file on my local file system as well.
But when I changed to ftp, I'm still can't create the file.
Error said "Could not create file ftp://myuser:mypassword@123.345.678.890/mynewfolder/myfile.txt"
"Could not create folder "ftp://myuser:mypassword@123.345.678.890/ beacuse it already exists
and is a file"
I test this ftp by reading a file that already exist and it's fine. but when I want to create
it failed.
Any ideas?
Thanks again,
Hi Geek (!)
I tried to use your example in my local file system, and ti doesn't work.
I just change the path of the new path, cutting off the first "/" and it works.
> FileObject f = fo.resolveFile("mynewfolder/myfile.txt");
Try that and good luck,
Ernesto.
geek.shrek escribió:
Hi,
I'm trying to create a file using VFS FTP but it said the file already exist
eventhough it's not exists
Could not create folder "ftp://myuser:myp...@123.345.678.890/"; because it
already exists and is a file
Here's my code.
try
{
FileObject fo = fsManager.resolveFile("ftp://myuser:myp...@123.345.678.890";, authenticate());
FileObject f = fo.resolveFile("/mynewfolder/myfile.txt");
System.out.println("f " + f.exists()); --> return false;
f.createFile();
System.out.println("Is readable: " + f.exists()); System.out.println("Last Modified" + f.getContent().getLastModifiedTime());
}
catch (FileSystemException e)
{
e.printStackTrace();
}
private FileSystemOptions authenticate()
{
StaticUserAuthenticator auth = new StaticUserAuthenticator(null,
this.username, this.password);
FileSystemOptions opts = new FileSystemOptions();
try
{
DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth);
}
catch (FileSystemException e1)
{
e1.printStackTrace();
}
return opts;
}
Could someone please point me how can I create file using VFS?
Thanks,
__________________________________________________________________________________
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/
|