Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 692635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:40:16+00:00 2026-05-14T02:40:16+00:00

I am writing some code to add file attachments into an application I am

  • 0

I am writing some code to add file attachments into an application I am building.

I have add & Remove working but I don’t know where to start to implement open.

I have an array of bytes (from a table field) and I don’t know how to make it automatically open e.g.

If I have an array of bytes which is a PDF, how do I get my app to automatically open Acrobat or whatever the currently assigned application for the extension is using C#?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T02:40:17+00:00Added an answer on May 14, 2026 at 2:40 am

    In order to open it in any external application, you’ll need to write the bytes to disk, then use Process.Start to launch the associated application on the temporary file. Just pass the temporary filename (with the appropriate extension) as the only argument the Process.Start, and it will open that file in the appropriate application.

    Some applications may have a way to feed a stream of bytes, but this would need to be handled by the target application explicitly.


    For sample code, you could do something like:

    byte[] filedata = GetMyByteArray();
    string extension = GetTheExtension(); // "pdf", etc
    
    string filename =System.IO.Path.GetTempFileName() + "." + extension; // Makes something like "C:\Temp\blah.tmp.pdf"
    
    File.WriteAllBytes(filename, filedata);
    
    var process = Process.Start(filename);
    // Clean up our temporary file...
    process.Exited += (s,e) => System.IO.File.Delete(filename); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing some code that will take a screenshot of another application, given its'
I am writing some code that will go through a file, edit it as
So I've been pigeon-holed into writing some Jython code. I've been using the latest
I am writing some code to generate an opml file from a list of
I am writing some code to parse an xml file of the following format
Im running into this error that I can't work out Im writing some code
I have this issue i am writing a array to a file but when
I am exporting gridview data to excel but that excel file add the some
I am writing an android application where the user can add and remove fields
I am writing a video streaming server application. I have an AVI file and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.