copying a file to the web
-
how can i copy a file to a website, ie. file.ext ---> http://site.site.com/folder it's not ftp, it's http that i need to use. any help would be great. thanks, Rob Tomson -- There are 10 kinds of people. Those who understand binary and those who don't.
-
how can i copy a file to a website, ie. file.ext ---> http://site.site.com/folder it's not ftp, it's http that i need to use. any help would be great. thanks, Rob Tomson -- There are 10 kinds of people. Those who understand binary and those who don't.
If no FTP is available, you're going to have to find out if the site supports file posts via http and what http form or mechanism is supposed to be used. There's no generic way of doing it that works for all sites. Other than FTP that is... RageInTheMachine9532
-
If no FTP is available, you're going to have to find out if the site supports file posts via http and what http form or mechanism is supposed to be used. There's no generic way of doing it that works for all sites. Other than FTP that is... RageInTheMachine9532
the way i've been putting my files in is creating a webfolder in windows and then copying my file(s) onto the site. just out of curiosity how do i upload a file via ftp also? thanks, Rob Tomson -- There are 10 kinds of people. Those who understand binary and those who don't.
-
the way i've been putting my files in is creating a webfolder in windows and then copying my file(s) onto the site. just out of curiosity how do i upload a file via ftp also? thanks, Rob Tomson -- There are 10 kinds of people. Those who understand binary and those who don't.
(this isn't really a C# topic but whatever :-)) Go to google and find a FTP client. There are some ones that present users with a drag and drop interface for you.
-
the way i've been putting my files in is creating a webfolder in windows and then copying my file(s) onto the site. just out of curiosity how do i upload a file via ftp also? thanks, Rob Tomson -- There are 10 kinds of people. Those who understand binary and those who don't.
What you're using then is WebDAV, which uses different HTTP headers to post files. Try a search in google for more information. To upload files using FTP, you can P/Invoke the relevent WinInet APIs or create your own
WebRequest
/WebResponse
derivative classes (there's plenty of documentation about this in the .NET Framework SDK) that implements that simple FTP protocol, which you can also find plenty of information about by searching with google.Microsoft MVP, Visual C# My Articles
-
What you're using then is WebDAV, which uses different HTTP headers to post files. Try a search in google for more information. To upload files using FTP, you can P/Invoke the relevent WinInet APIs or create your own
WebRequest
/WebResponse
derivative classes (there's plenty of documentation about this in the .NET Framework SDK) that implements that simple FTP protocol, which you can also find plenty of information about by searching with google.Microsoft MVP, Visual C# My Articles
just an update; i succesfully wrote a text string to a file on an http site. if you have any suggestions please let me know.
private void publish() { this.Cursor = System.Windows.Forms.Cursors.WaitCursor; this.btnPublish.Enabled = false; this.btnPublish.Text = "Wait..."; System.Net.WebClient client = new System.Net.WebClient();; string fullPath; string fileText; byte[] byteArray; System.IO.Stream stream; System.IO.StreamWriter sWriter; fullPath = this.xml.Find("BaseURL") + '/' + this.xml.Find("PublishName") + ".ics"; fileText = this.convertiCal(); byteArray = System.Text.Encoding.ASCII.GetBytes(fileText); client.Credentials = new System.Net.NetworkCredential(this.xml.Find("Login"), this.xml.Find("Password")); stream = client.OpenWrite(fullPath, "PUT"); sWriter = new System.IO.StreamWriter(stream); sWriter.Write(fileText); try { sWriter.Flush(); sWriter.Close(); } catch (System.Net.WebException err) { System.Windows.Forms.MessageBox.Show(err.Message, "Error", System.Windows.Forms.MessageBoxButtons.OK); } client.Dispose(); this.btnPublish.Text = "&Publish"; this.btnPublish.Enabled = true; this.Cursor = System.Windows.Forms.Cursors.Default; }
thanks for the help, Rob Tomson -- There are 10 kinds of people. Those who understand binary and those who don't.