Reputation: 2297
We need to find a way to upload Windows text, files at random times from random PCs. We currently do this via FTP APIs from Windows Desktop .net exe programs. Google does not appear to support this type of access - have I missed something?
The gsutil
, Platform SDK, and other external Python tools will not work for us.
Solution needs to be built using Visual Studio for Windows Desktop. REST via .Net HTTP would be OK.
Upvotes: 0
Views: 1302
Reputation: 38399
Google Cloud Storage does not directly support FTP-based uploads.
GCS does, however, have a .NET client library. You can certainly upload objects with that.
There are sample apps showing how to upload an object to GCS with that library. The key bit is:
private void UploadFile(string bucketName, string localPath,
string objectName = null)
{
var storage = StorageClient.Create();
using (var f = File.OpenRead(localPath))
{
objectName = objectName ?? Path.GetFileName(localPath);
storage.UploadObject(bucketName, objectName, null, f);
Console.WriteLine($"Uploaded {objectName}.");
}
}
Upvotes: 4