I am currently trying to make a simple file uploader using http://msdn.microsoft.com/en-us/library/w3kksch7.aspx
and its pretty straight forward except I keep getting the error Access To the path 'E:\Temporary' is denied
I tried running visual studio 2012 as admin
I already change the directory (It was at C: earlier)
Help and advice is appreciated Thank You

Public class Upload
Private Sub browse_btn_Click(sender As Object, e as EventArgs) Handles browse_btn.Click
Dim result As DialogResult
Using ofd As New OpenFileDialog
ofd.InitialDirectory = My.Computer.FileSystem.SpecialDirectorie.MyDocuments
itemLoc_txt = ofd.FileName
End Sub

Private Sub upload_btn_Click(sender As Object, e as EventArgs) Handles upload_btn.Click
Try
My.Computer.Network.UploadFile("itemLoc_txt.Text","E:\Temporary")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class

Can you post your solution so than everyone can see it..

Thanks:-)

The second parameter must be a web address, like in the examples in this article. Why would you want to use that function just to copy a file from one place to another on your own computer?

My solution is that I needed the SafeFileName So when The Code is NOw

Public class Upload
Dim filename As String
Private Sub browse_btn_Click(sender As Object, e as EventArgs) Handles browse_btn.Click
Dim result As DialogResult
Using ofd As New OpenFileDialog
ofd.InitialDirectory = My.Computer.FileSystem.SpecialDirectorie.MyDocuments
itemLoc_txt = ofd.FileName
filename = ofd.SafeFileName
End Sub
Private Sub upload_btn_Click(sender As Object, e as EventArgs) Handles upload_btn.Click
Try
My.Computer.Network.UploadFile("itemLoc_txt.Text","E:\Temporary\" + filename)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class

Vb needed the filename for it I used SafeFileName cause if you just give it a name it will not have an extension

@Ancient Dragon I'm just simulating it in my pc Thats All :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.