Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to upload a file directly and show it on screen directly without using database in c#.like preview.file format may be anyformat no condition..
Posted
Comments
CHill60 29-Apr-15 9:49am    
What have you tried?
What sort of file?

you can upload with System.Net.Webclient.

You can start with Process.Start() native software for your file. Important: you should have an application to open your file type in your system.
 
Share this answer
 
Comments
Member 11507028 29-Apr-15 13:07pm    
dont get u actually .would u please eleborate it with example
C#
      var webClient = new WebClient();

      webClient.OpenReadCompleted += (o, e) =>
      {
        if (e.Error != null || e.Cancelled)
        {
          return;
        }

        Stream stream = (Stream)e.Result;
        BinaryReader reader = new BinaryReader( stream );

        byte[] buffer = reader.ReadBytes( (int)stream.Length );

// you must save your file from buffer in localfilePath
//than you start Process.Start(localfilePath);

        e.Result.Close();
      };

      Uri baseUri = new Uri(webClient.BaseAddress);

      webClient.OpenReadAsync(new Uri(youServerUri, UriKind.Absolute), localFilePath);
 
Share this answer
 

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