我正在使用下拉列表将文件上传到dropbox。在此之前,一切都很顺利,但只适用于上面的小文件。下面是我用来发送的代码:
private void btnEnviar_Click(object sender, EventArgs e)
{
var _client = new DropNetClient("xxxxxxxxxxxxx", "xxxxxxxxxxxxxx", "xxxxxxxxxxxxx", "xxxxxxxxxxxxxxxx");
_client.UseSandbox = true;
string arq = "";
string path = "";
foreach (DataGridViewRow dr in dgvArquivos.Rows)
{
if (dr.Cells[0].Value != null)
{
arq = dr.Cells[3].Value.ToString();
path = "//server/documentos/Scanner_/exames";
try
{
var filebytes = new FileInfo(@path+"/"+arq);
byte[] content = _client.GetFileContentFromFS(filebytes);
var result=_client.UploadFile("/exames",arq,content);
this.lblMsg.Text = result.ToString();
dr.Cells[4].Value = "17/12/2014";
}
catch (Exception ex)
{
this.lblMsg.Text= ex.Message.ToString();
}
}
}
}如何发送平均大于50 on的文件?
发布于 2014-12-21 21:19:45
根据实际的错误,您得到的答案可能会改变。ie,如果内存不足或API中的HTTP错误。
DropNet确实支持分块上传文件,您可能需要查看这些文件。目前它的文档有点缺乏,但是查看源代码应该会告诉您如何使用它。https://github.com/DropNet/DropNet/blob/master/DropNet/Client/Files.Sync.cs#L224
调用StartChunkedUpload启动上传,调用AppendChunkedUpload向上传添加更多字节,然后调用CommitChunkedUpload完成上传。如果可能的话,可以将它与文件的流读取一起使用,以减少内存的使用。
https://stackoverflow.com/questions/27550600
复制相似问题