Hello Everyone,
This site is amazing. I have learnt so much reading the many posts.
Does anyone have any suggestions as to what the best way of uploading a queue of files is?
I am currently creating a FTPWebrequest to handle my uploading (the webrequest section of my function is below). At the moment my code loops through this webrequest section for each file - giving the file path of each file in the string "CompleteLocalPath". For each file it creates a webrequest and giving the required file path, uploading the file using a file stream, and then closing the stream. This works, but seems to take quite a long time.
Can you recommend a more efficient way? Perhaps by using one webrequest but modifying the upload path?
Thank you very much for your help
Code:Dim fwr As FtpWebRequest = FtpWebRequest.Create("ftp://ftp-server.com/directory/"+path.getfilename(completelocalpath)) fwr.Credentials = New NetworkCredential("username", "password") fwr.Method = WebRequestMethods.Ftp.UploadFile Dim requestStream As FileStream = File.OpenRead(CompleteLocalPath) Dim buffer(requestStream.Length) As Byte requestStream.Read(buffer, 0, buffer.Length) requestStream.Close() requestStream = Nothing fwr.GetRequestStream.Write(buffer, 0, buffer.Length) fwr = Nothing




Reply With Quote