Convert js byte[] to bytes

pe4enpe4en Member Posts: 2
Hi.
I have this contract:

contract T {

string log;
function getLastLog() constant returns (string lastLog) { return log; }

int i;

struct TStruct {
int id;
bytes file;
string name;
}

mapping (address => TStruct ) structes;

function uploadStruct(address _user, string _name, bytes _arr) {
i++;
structes[_user] = TImage({id: i, name: _name, file:_arr});
}

function getName(address _user) external constant returns (string _name) {
return structes[_user].name;
}
}

and code in js:
//arr is very long byte array
var arr=[];
//myContract is deployed contract
//this comand executed with message "Error: Intrinsic gas too low"
myContract.uploadStruct.sendTransaction("0x026cb747e2e55ccd133994934673895d0caea8d2", "test", arr, {gas: 4000000});

I trying different numbers of gas. I think problem with parametr arr.
How I can convert js byte array to solidity bytes?
Sign In or Register to comment.