I'm using Sharefile API and I'm trying to download files from Sharefile but when I do it I get the message:
Access to path 'C:\_testing' is denied.
Here's part of the code to the download method:
Public Sub FileDownload(ByVal fileId As String, ByVal localPath As String)
...
...
Try
Dim target As FileStream = New FileStream(localPath, FileMode.Create, FileAccess.Write)
Dim chunk(8192) As Byte
Dim len As Integer
...
...
...
End Sub
At the line where I define "target" it throws an exception and the message is the one posted above the code sample.
Why is this? My test folder has read/write permissions and FileMode is set to "Create". Also, I've tried in different locations and without any luck.
After many comments, i'll try to post an answer.
Dim target As FileStream = New FileStream(localPath & fileId, FileMode.Create, FileAccess.Write)
You want to download a FILE, not a FOLDER.
For instance,
Dim target As FileStream = New FileStream("C:\Users\Me\Desktop", FileMode.Create, FileAccess.Write)
throws an error,
Dim target As FileStream = New FileStream("C:\Users\Me\Desktop\test.jpg", FileMode.Create, FileAccess.Write)
doesn't.