GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Microsoft  >  C#
Go To First  |  Previous Question  |  Next Question 
 C#  |  Question 361 of 436    Print  
how to upload a file in c# console application

  
Total Answers and Comments: 2 Last Update: February 15, 2007     Asked by: jacin 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
February 12, 2007 06:37:55   #1  
Rajesh K        

RE: how to upload a file in c# console application
We can do the File Upload process using System.IO namespace.It gives different method for handling File System Functionality as well as Directory Functionality.Using System.IOClass Test{ Public Void Main(String args[]){string FileUpload;string DestFolder;FileUpload Console.ReadLine(); if (File.IsExists(FileUpload) && File.IsExists(DestFolder) ) {File.Copy(FileUpload DestFolder); }else {Console.WriteLine( Please check the Source File or Destination Folder Exist ); }}}
 
Is this answer useful? Yes | No
February 15, 2007 04:05:17   #2  
vishal        

RE: how to upload a file in c# console application
Use System.Net.WebClient Class use UploadFile method provided by the class. It accepts the Uri or string as destination and another parameter as location of file to be uploaded.
 
Is this answer useful? Yes | No

 Related Questions

Use a conditional attribute on the method, as shown below: class Debug{[conditional("TRACE")]public void Trace(string s){Console.WriteLine(s);}}class MyClass{public static void Main(){Debug.Trace("hello");}}In 
Latest Answer : Well, you cant add the namespace System.Diagnostics.ConditionalAttribute. Actually you need to add the namespace System.Diagnostics and capitalise "Conditional" like so:using System;using System.Diagnostics;namespace Debug{    class ...

Strings are not null terminated in the runtime, so embedded nulls are allowed. Console.WriteLine() and all similar methods continue until the end of the string.  
Latest Answer : Console.WriteLine() stop printing when it reaches a 'Carriage Return' (denotes next line) character within a string! ...

Make sure that the target type set in the project properties setting is set to Windows Application, and not Console Application. If you're using the command line, compile with /target:winexe & 
Latest Answer : Compile with following syntax at command line     :      csc /t:winexe ...

The equivalent of inout in C# is ref. , as shown in the following example: public void MyMethod (ref String str1, out String str2) {...}When calling the method, it would be called like this: String s1;String 
Latest Answer : Ans:Answer: The equivalent of inout in C# is ref. , as shown in the following example: public void MyMethod (ref String str1, out String str2) {...}When calling the method, it would be called like this: String s1;String s2;s1 = "Hello";MyMethod(ref s1, ...

This is currently not supported by Visual Studio .NET.  
Latest Answer : It is not possible ...

Yes. Here's a simple example: using System;class Class1 {private string[] MyField;public string[] MyProperty {get { return MyField; }set { MyField = value; }}}class MainClass{public static int Main(string[] 
Latest Answer : yes u can use indexer.its working is same as properties. ...

The easiest way is to use goto: using System;class BreakExample {public static void Main(String[] args) {for(int i=0; i 
Latest Answer : Yes, there are ways to break out of nested loops.  Although GOTO is allowed in C#, it is normally a bad idea, bad style, and indication of lack of good software development foundation of those who use it (no offense intended).Here are a couple of ...

In a garbage collected environment, it's impossible to get true determinism. However, a design pattern that we recommend is implementing IDisposable on any class that contains a critical resource. 

Here's an example: using System;class StringToInt{public static void Main(){String s = "105";int x = Convert.ToInt32(s);Console.WriteLine(x);}}  
Latest Answer : Ans:by using onvert.ToInt32(string)ExampleString s = "45";int x = Convert.ToInt32(s); ...

Yes, you can use System.Environment.Exit(int exitCode) to exit the application or Application.Exit() if it's a Windows Forms app.  
Latest Answer : Ans:YesSystem.Environment.Exit(int exitCode) to exit the application or Application.Exit() if it's a Windows Forms app. ...


 Sponsored Links

 
Related Articles

Application Development in .NET

ASP NET 2 0 Tutorials Application development in NET Client Side Application Development Client applications are applications that run on the client system or the desktop of the user They are closest to the traditional windows based applications and they display forms or windows on the desktop enabl
 

N-Tier Application Partitioning

N Tier Application Partitioning Application partitioning is a vital process as it provides one with the opportunity to clearly define an even distribution of an application s presentation process and key data components without which you may find yourself feeling quite lost The components may be dis
 

N-Tier Application Manageability

N Tier Application Manageability While it is a fact that N Tier applications tend to provide almost limitless scalability the desire to change or add new forms of functionality can present a challenge in more than one arena Growth on a large scale can make capacity planning quite hard When available
 

What is Data File

In a logical data model, the conceptual data model which is based on the business semantic is being defined. Thus, entities and relationships and corresponding table and column design, object oriented classes, and XML tags, among other things are being laid regardless of the database will be physica
 

Application Frameworks in SQL Server 2005

The new application framework of SQL called the Service Broker is a distributed application framework that provides relable asynchronous messaging at the database to database level. It allows internal and external processes to exchange streams of reliable asynchronous messages using extensions of T-
 

Rapid Application Development

What is RAD? One of the conveniences of developing software is that it is not a physical tool that can be lost once it gets developed or manufactured. Codes are used to implement the software and it does not disappear together with the product. We can re-use the code all over again in another softw
 

The Interview Snafu

How to turn someone else’s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Effective Controls for Attaining Continuous Application Security

Effective Controls for Attaining Continuous Application Security Throughout the Web Application Development Life Cycle Given the choice, every organization would want secure Web sites and applications from the Web application development phase all the way through the software development life cycle.
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won’t get over the line without a polished, prof
 

Web Application Vulnerability Assessment Essentials

Your First Step to a Highly Secure Web Site If an organization taking a systematic and proactive approach to web security, and to running a web application vulnerability assessment in particular, then that organization defended against the most rapidly increasing class of attacks. &nb
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape