c# - Upload File from Local to Remote URL Server -
i need upload files remote directory having difficulty in doing so.
any idea or links please?
i have tried web client , posted file upload approach.
what need e.g. www.google.com\file\upload.txt
c:\www.google.com\file\upload.txt
try 1 solution code
string filepaths = path.combine(appdomain.currentdomain.basedirectory, "\\www.google.com\\file\\upload.txt"); using (streamwriter writer = new streamwriter(filepaths, true)) { writer.write("word "); writer.writeline("word 2"); writer.writeline("line"); }
try 2 solution code
string mydocpath = environment.getfolderpath(environment.specialfolder.mydocuments); string filepath = mydocpath + @"\upload.txt"; webclient client = new webclient(); uri addy = new uri("www.google.com\\file\\upload.txt"); byte[] arrreturn = client.uploadfile(addy, filepath); console.writeline(arrreturn.tostring());
regards
Comments
Post a Comment