.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

upload file based ip address

Posted By: Catherine     Posted Date: June 07, 2011    Points:5   Category :C#
how to upload the file using ip address like this 162.168.98.56/foldername

Responses
Author: Sasi Prabhu             
Posted Date: June 07, 2011     Points: 20   

R u want to create folder or filename ?

To get Client IP Address

request.Params["REMOTE_ADDR"];

To Create Folder at Runtime :

system.io.directory.createdirectory("foldername");

if u want to create folder inside the another folder :

system.io.directory.createdirectory(Server.MapPath("~/Files/"+<newfoldername>));

Thanks & Regards,
Sasi Prabhu.
Author: Gowthammanju             
Posted Date: June 07, 2011     Points: 20   

hi
be clear in asking question such as from wer u should upload the document in to ur pages!

wat ur overall outcome

post ur questions with correct details


Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true
Author: Gowthammanju             
Posted Date: June 07, 2011     Points: 20   

Hi dude

You have to use webclient from system.net namespace.
In the remote IP system , if the folder is mapped properly then you can upload the file by using the below code snippet.

http://msdn.microsoft.com/en-us/library/36s52zhs.aspx#Y1370

Console.Write("\nPlease enter the URI to post data to : ");
String uriString = Console.ReadLine();


// Create a new WebClient instance.
WebClient myWebClient = new WebClient();

Console.WriteLine("\nPlease enter the fully qualified path of the file to be uploaded to the URI");
string fileName = Console.ReadLine();
Console.WriteLine("Uploading {0} to {1} ...",fileName,uriString);


// Upload the file to the URI.

// The 'UploadFile(uriString,fileName)' method implicitly uses HTTP POST method.

byte[] responseArray = myWebClient.UploadFile(uriString,fileName);


// Decode and display the response.

Console.WriteLine("\nResponse Received.The contents of the file uploaded are:\n{0}", 
System.Text.Encoding.ASCII.GetString(responseArray));



these are the solutions which u can able to retrive

Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true
Author: Catherine             
Posted Date: June 07, 2011     Points: 20   

thank you



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend