Add new attachment

Only authorized users are allowed to upload new attachments.

This page (revision-13) was last changed on 09-Oct-2016 18:14 by Ben Spink

This page was created on 09-Oct-2016 18:14 by Ben Spink

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Difference between version and

At line 3 changed one line
In the user manager, make a new VFS item. Set its protocol to be CUSTOM, and use a URL like this:
In the user manager, make a new VFS item. Set its protocol to be FILE. Save your changes, and close the user manager. Now go find the users folder, your server group, then your user, then the VFS folder, and finally the name of the VFS item you just saved. Edit it with a text editor, and set the URL to be:
At line 5 changed one line
CUSTOM_com.myprotocol.VFS_MyProtocol://any_data_you_want_on_the_url/
CUSTOM_com.myprotocol.MyProtocol://any_data_you_want_on_the_url:port/
At line 7 added 2 lines
Now you are ready to login. This class must be on the class path for CrushFTP for it to work.
At line 16 changed one line
public class VFS_MyProtocol
public class MyProtocol
At line 22 changed one line
public VFS_MyProtocol(VFS uVFS, String urlStr, Properties vItem)
public MyProtocol(VFS uVFS, String urlStr, Properties vItem)
At line 34 added one line
File f = new File(url.getPath()+path);
At line 33 changed one line
dir_item.put("url",url+path);
dir_item.put("url",url+path+(f.isDirectory()?"/":""));
At line 35 changed 3 lines
dir_item.put("protocol", "ftp");
dir_item.put("type", "FILE");
dir_item.put("permissions", "drwxrwxrwx");
dir_item.put("protocol", "file");
dir_item.put("type", f.isFile()?"FILE":"DIR");
dir_item.put("permissions", (f.isFile()?"-":"d")+"rwxrwxrwx");
At line 41 changed one line
dir_item.put("size", "0");
dir_item.put("size", f.length()+"");
At line 45 changed 3 lines
dir_item.put("name", "test");
dir_item.put("local", "false");
dir_item.put("dir", path);
dir_item.put("name", f.getName());
dir_item.put("local", "true");
dir_item.put("root_dir", path);
At line 54 changed one line
Common.debug(2,"ls "+url+path);
Common.debug(0,"ls "+url+path);
File fs[] = new File(url.getPath()+path).listFiles();
if (fs != null)
{
for (int x=0; x<fs.length; x++)
{
File f = fs[x];
Properties p = get_item(path+"/"+f.getName());
list.addElement(p);
}
}
At line 59 changed 13 lines
Common.debug(2,"get "+item.getProperty("url"));
InputStream inStream = null;
long skipped = 0;
long amt = seekPos - skipped;
while(skipped < seekPos)
{
long l = inStream.skip(amt);
if (l > 0) skipped += l;
else break;
amt = seekPos - skipped;
}
Common.debug(0,"get "+item.getProperty("url"));
VRL u = new VRL(item.getProperty("url"));
InputStream inStream = new FileInputStream(u.getPath());
inStream.skip(seekPos.longValue());
At line 77 changed 4 lines
Common.debug(2,"put "+item.getProperty("url"));
OutputStream outStream = null;
Common.debug(0,"put "+item.getProperty("url"));
VRL u = new VRL(item.getProperty("url"));
RandomAccessFile raf = new RandomAccessFile(u.getPath(),"rw");
if (raf.length() > seekPos.longValue()) raf.setLength(seekPos.longValue());
raf.close();
OutputStream outStream = new FileOutputStream(u.getPath(),true);
At line 86 changed one line
Common.debug(2,command +" "+item.getProperty("url"));
Common.debug(0,command +" "+item.getProperty("url"));
VRL u = new VRL(item.getProperty("url"));
At line 99 added one line
new File(u.getPath()).delete();
At line 104 added one line
new File(u.getPath()).delete();
At line 109 added one line
new File(u.getPath()).mkdirs();
At line 105 changed one line
s = "213 " + sdf.format(new Date());
if (new File(u.getPath()).exists()) s = "213 " + sdf.format(new Date(new File(u.getPath()).lastModified()));
else throw new Exception("File does not exist.");
At line 109 changed one line
s = "213 0";
if (new File(u.getPath()).exists())
{
if (new File(u.getPath()).isDirectory() && new File(u.getPath()).listFiles() != null) s = "213 "+new File(u.getPath()).listFiles().length;
else s = "213 "+new File(u.getPath()).length();
}
else throw new Exception("File does not exist.");
At line 123 changed 2 lines
Common.debug(2,"rename "+item1.getProperty("url") + " to " + item2.getProperty("url"));
return new Boolean(false);
Common.debug(0,"rename "+item1.getProperty("url") + " to " + item2.getProperty("url"));
VRL u1 = new VRL(item1.getProperty("url"));
VRL u2 = new VRL(item2.getProperty("url"));
return new Boolean(new File(u1.getPath()).renameTo(new File(u2.getPath())));
At line 146 added one line
Version Date Modified Size Author Changes ... Change note
13 09-Oct-2016 18:14 0.186 kB Ben Spink to previous
12 09-Oct-2016 18:14 0.184 kB Ben Spink to previous | to last
11 09-Oct-2016 18:14 5.454 kB Ben Spink to previous | to last
10 09-Oct-2016 18:14 5.366 kB Ben Spink to previous | to last
9 09-Oct-2016 18:14 5.218 kB Ben Spink to previous | to last
8 09-Oct-2016 18:14 4.812 kB Ben Spink to previous | to last
7 09-Oct-2016 18:14 4.821 kB Ben Spink to previous | to last
6 09-Oct-2016 18:14 4.761 kB Ben Spink to previous | to last
5 09-Oct-2016 18:14 4.728 kB Ben Spink to previous | to last
4 09-Oct-2016 18:14 3.205 kB Ben Spink to previous | to last
3 09-Oct-2016 18:14 0.293 kB Ben Spink to previous | to last
2 09-Oct-2016 18:14 0.117 kB Ben Spink to previous | to last
1 09-Oct-2016 18:14 0.028 kB Ben Spink to last
« This page (revision-13) was last changed on 09-Oct-2016 18:14 by Ben Spink
G’day (anonymous guest)

OLD WIKI!!!#

New: CrushFTPv9#

OLD WIKI!!!#


CrushFTP8 | What's New

Referenced by
LeftMenu

JSPWiki