Developing a webpage form to FTP tranfer to a private FTP with asp.net C#

PHOTOSONTHESPOT
PHOTOSONTHESPOT used Ask the Experts™
on
Hello,

I am building a file submission form (mostly image format, jpg, png, tiff) on my godaddy site, but I would like that when the user presses upload, that it goes straight to my private ftp located somewhere else, because I'm expecting to supasse bandwith and space limited by godaddy. I would like it to be in c# because that is what i'm trying to learn. Thank you,
Marc
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Sr. Software Architect
Commented:
ManualResetEvent waitObject;
           
            Uri target = new Uri (args[0]);
            string fileName = args[1];
            FtpState state = new FtpState();
            FtpWebRequest request = (FtpWebRequest)WebRequest.Create(target);
            request.Method = WebRequestMethods.Ftp.UploadFile;
           
            // This example uses anonymous logon.
            // The request is anonymous by default; the credential does not have to be specified.
            // The example specifies the credential only to
            // control how actions are logged on the server.
           
            request.Credentials = new NetworkCredential ("anonymous","janeDoe@contoso.com");
           
            // Store the request in the object that we pass into the
            // asynchronous operations.
            state.Request = request;
            state.FileName = fileName;
           
            // Get the event to wait on.
            waitObject = state.OperationComplete;
           
            // Asynchronously get the stream for the file contents.
            request.BeginGetRequestStream(
                new AsyncCallback (EndGetStreamCallback),
                state
            );
           
            // Block the current thread until all operations are complete.
            waitObject.WaitOne();
           
            // The operations either completed or threw an exception.
            if (state.OperationException != null)
            {
                throw state.OperationException;
            }
            else
            {
                Console.WriteLine("The operation completed - {0}", state.StatusDescription);
            }

Author

Commented:
I'm really new, could you jus specify where all this goes, and seperate the part that html and code behind, i would appreciate it,.

Author

Commented:
Thank you - the question was  from our junior programmer.  The solution works as is.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial