Visual Basic .NET Forums  
Click here to advertise with us

Go Back   Visual Basic .NET Forums > VB.NET > VB.NET General Discussion

VB.NET General Discussion VB.NET general discussion area

VB.NET Forums Newsletter Signup:
Email address:


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-28-2009, 8:00 AM
VB.NET Forum Newbie
.NET Framework: .NET 3.0 (VS 2005/2008)
 
Join Date: Dec 2008
Age: 17
Posts: 2
Reputation: 0
spukemiszer is on a distinguished programming path ahead
Exclamation need help uploading ftp

first time posting hope its in correct spot

so im making a program that uses excel as the database as im leanring and dont know how to use a database yet.



it reads the excel file from www.fakesite/test/file.xls

the file contains username/password/accounttype

i load the file with

Quote:
Dim xlApp As Excel.Application
Dim xlWorkBook As Excel.Workbook
Dim xlWorkSheet As Excel.Worksheet

xlApp = New Excel.ApplicationClass
xlWorkBook = xlApp.Workbooks.Open("site")

xlWorkSheet = xlWorkBook.Worksheets("users")
i can add new users / passwords / types
but i want to resave it back to the ftp site

i have tried
Quote:
Dim credential As New NetworkCredential("username", "password")
Upload(users.xls, "ftp://site/Test/users.xls", credential)
with sub as
Quote:
Private Sub Upload(ByVal source As String, ByVal target As String, _
ByVal credential As NetworkCredential)
Dim request As FtpWebRequest = _
DirectCast(WebRequest.Create(target), FtpWebRequest)
request.Method = WebRequestMethods.Ftp.UploadFile
request.Credentials = credential
Dim reader As New FileStream(source, FileMode.Open)
Dim buffer(Convert.ToInt32(reader.Length - 1)) As Byte
reader.Read(buffer, 0, buffer.Length)
reader.Close()
request.ContentLength = buffer.Length
Dim stream As Stream = request.GetRequestStream
stream.Write(buffer, 0, buffer.Length)
stream.Close()
Dim response As FtpWebResponse = DirectCast(request.GetResponse, FtpWebResponse)
MessageBox.Show(response.StatusDescription, "File Uploaded")
response.Close()
End Sub
how would i save the "xlwoorkbook" file using ftp replacing the original

id prefer not to have to save a copy to my computer then back to the site.

if you need more information please ask as i am unsure of what else to tell you
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -4. The time now is 7:50 PM.

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2


For advertising opportunities click here.