Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to make an auto uploader to websites with C#
For instance, I'm trying to create an auto uploader for websites like http://www.fileflyer.com/default.aspx, http://multiupload.com, shareflare, letitbit etc...
The website asks the user to check the "I agree to Terms of Service" and asks him to enter an email.

P.S I searched the internet a bit and I found this[^].
However, it did not work with multiupload and fileflyer (which are fundamental for me to accomplish this).
Can anyone give me a small example or some info about that? an example would be perfect
Thanks from advance, Adam.
Posted

1 solution

you have to look up for API in your target sites, a web service maybe!
then include it in your projects, and then read their documents to config!
but if you want just upload file to server use this code snippet:
C#
private void SaveTToWeb()
{
    try
    {
        //create WebClient object
        WebClient client = new WebClient();
        string myFile = @"C:\file.txt";
        client.Credentials = CredentialCache.DefaultCredentials;
        client.UploadFile(@"http://myweb.com/projects/idl/Draft Results/RK/myFile", "PUT", myFile);
        client.Dispose();
    }
    catch (Exception err)
    {
        MessageBox.Show(err.Message);
    }
}

and if you want to use ftp, read this:
C# ftp upload[^]
 
Share this answer
 
Comments
sahabiswarup 13-Feb-13 1:53am    
i've tried your code but getting an error
“The remote server returned an error: (405) Method Not Allowed.”

can you please help me to get out of this?
taha bahraminezhad Jooneghani 24-Mar-13 8:24am    
All 405 errors can be traced to configuration of the Web server and security governing access to the content of the Web site.
check if you have the permission to access that root on your server!
DilaraSina 1-Dec-16 5:04am    
I've permission to access that root, but i'm getting this error. Do you know what else may cause that?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900