传输文件从客户端到服务器

public server static void  Main(args _args)
{
    BinData             binData = new BinData();
    Container           con;
    myClass             myclass;
    FileIoPermission    perm;
    Filename            filename = "C:\\Sunset.jpg";
    Filename            tofilename = "D:\\1111.jpg";
    ;

    perm = new FileIoPermission(tofilename, "w");
    perm.assert();

    con = myclass::GetFileDataOnClient(filename);
    binData.setData(con);
    binData.saveFile(tofilename);
    CodeAccessPermission::revertAssert();
}

public client static container GetFileDataOnClient(FileName _fileName)
{
    BinData  binData = new BinData();
    FileIoPermission    perm;
    ;

    if (WinAPI::fileExists(_filename))
    {
        perm = new FileIoPermission(_filename,"r");
        perm.assert();
        binData.loadFile(_fileName);
        CodeAccessPermission::revertAssert();
        return BinData.getData();
    }

    return conNull();
}
posted @ 2012-08-02 14:36  perock  阅读(525)  评论(0编辑  收藏  举报