Click here to Skip to main content
       

ASP.NET

 
Questionsign in Popup like codeproject.com PinmemberRA|-|UL PATEL6-Nov-12 1:27 
AnswerRe: sign in Popup like codeproject.com PinmemberMatt U.6-Nov-12 2:14 
QuestionNeed help to upload 500 MB file on FTP Pinmembersilentspeaker6-Nov-12 0:39 
AnswerRe: Need help to upload 500 MB file on FTP PinmemberRichard Deeming6-Nov-12 1:32 
GeneralRe: Need help to upload 500 MB file on FTP Pinmembersilentspeaker6-Nov-12 3:31 
GeneralRe: Need help to upload 500 MB file on FTP PinmemberRichard Deeming6-Nov-12 4:05 
GeneralRe: Need help to upload 500 MB file on FTP Pinmembersilentspeaker6-Nov-12 4:38 
GeneralRe: Need help to upload 500 MB file on FTP PinmemberRichard Deeming6-Nov-12 4:59 
Something like this:
 
Private Function UploadToFTP(ByVal fileToUpload As HttpPostedFile) As Boolean
   Try
      Dim uploadUrl As String = "ftp://........................."
      Dim uploadFileName As String = fileToUpload.FileName
      
      Using streamObj As Stream = fileToUpload.InputStream
         Dim buffer As [Byte]() = New [Byte](fileToUpload.ContentLength - 1) {}
         streamObj.Read(buffer, 0, buffer.Length)
      End Using
      
      Dim ftpUrl As String = String.Format("{0}/{1}", uploadUrl, uploadFileName)
      Dim requestObj As FtpWebRequest = TryCast(FtpWebRequest.Create(ftpUrl), FtpWebRequest)
      requestObj.Method = WebRequestMethods.Ftp.UploadFile
      requestObj.Credentials = New NetworkCredential("UserID", "Password")
      
      Using requestStream As Stream = requestObj.GetRequestStream()
         requestStream.Write(buffer, 0, buffer.Length)
         requestStream.Flush()
      End Using
      
      Using responseObj As FtpWebResponse = TryCast(requestObj.GetResponse(), FtpWebResponse)
         ' TODO: Look at responseObj.StatusCode to see if the upload succeeded
      End Using
      
      Return True
      
   Catch ex As Exception
      Return False
   End Try
End Function



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: Need help to upload 500 MB file on FTP Pinmembersilentspeaker6-Nov-12 5:05 
GeneralRe: Need help to upload 500 MB file on FTP PinmemberRichard Deeming6-Nov-12 5:16 
AnswerRe: Need help to upload 500 MB file on FTP [modified] Pinmemberjkirkerx7-Nov-12 13:45 
AnswerRe: Need help to upload 500 MB file on FTP Pinmemberxut24477-Nov-12 14:37 
QuestionHow to Get Local Area IP Address? PinmemberNandan Basak5-Nov-12 22:15 
AnswerRe: How to Get Local Area IP Address? PinmemberBernhard Hiller6-Nov-12 21:11 
GeneralRe: How to Get Local Area IP Address? PinmemberNandan Basak4-Dec-12 19:08 
AnswerRe: How to Get Local Area IP Address? Pinmemberrameshkashanna7-Nov-12 2:05 
GeneralRe: How to Get Local Area IP Address? PinmemberNandan Basak4-Feb-13 2:05 
QuestionAn error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. PinmemberRKSPradeep4-Nov-12 20:11 
JokeRe: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Pinmembern.podbielski4-Nov-12 20:52 
AnswerRe: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Pinmemberryanb315-Nov-12 5:37 
Questionvariable for aspx and all its ascx Pinmemberjrahma4-Nov-12 8:25 
AnswerRe: variable for aspx and all its ascx Pinmembern.podbielski4-Nov-12 10:17 
GeneralRe: variable for aspx and all its ascx PinmemberAmir Jalilifard5-Nov-12 8:15 
Questionhttpmodule, context.items.add("originalUrl") Pinmemberjkirkerx3-Nov-12 19:44 
Questionhow to split a page using frameset Pinmemberfahad.11-Nov-12 2:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 23 Jul 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid