Uploading Files to C # .net Windows Application

I want to upload some files to a site host in C # .net Windows Application. What is the best way to upload a file to a Windows application?

+2


a source to share


3 answers


It depends on your server. If it's yours, you can make it listen to post requests and upload files there. If it's not yours, ftp might be installed, so you can try that.



See here for ftp downloads: http://www.vcskicks.com/csharp_ftp_upload.php and here for using HTTP requests: http://en.csharp-online.net/HTTP_Post

+3


a source


I found that SVN is the best way so far, install the client on your local machine and on the server. and install the SNV server on your server.



Server: http://www.visualsvn.com/server/
Client: http://tortoisesvn.net/downloads.html

+2


a source


file upload in c #

                HttpPostedFileBase file = this.Request.Files["Upload"];
                if (file != null)
                {
                    var fileName = file.FileName;
                    var fileExtension = Path.GetExtension(fileName);
                    filePath = fileName.Replace(fileName, emailTemplateImage.token + fileExtension);
                    var imagepath = Server.MapPath("/Upload/EmailTemplateImage/") + filePath;
                    if (!System.IO.Directory.Exists(filePath))
                    {
                        System.IO.Directory.CreateDirectory(filePath);
                    }
                    file.SaveAs(imagepath);
                }

      

+2


a source







All Articles