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 8550109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:52:33+00:00 2026-06-11T13:52:33+00:00

I am working on C# program to upload image file to netsuite. Can anybody

  • 0

I am working on C# program to upload image file to netsuite. Can anybody help me how to invoke netsuite script(written in
java script) in C# because I can find upload api only in netsuite script. Is there any webservices or functions
in netsuite to upload image file in netsuite ?

  • 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-06-11T13:52:35+00:00Added an answer on June 11, 2026 at 1:52 pm

    You can upload a file directly with SuiteTalk. Examples below are written in C#.

    Call the below methods like this:

    uploadFile(@"SERIAL_NUMBERS.csv", "csv", "123456");
    

    Methods:

    public static void UploadFile(string filename, string filetype, string folderId)
        {
    
            var sFileName = filename;
    
            var sNsFileName = filename;
    
            var sFileType = filetype;
    
            var sFolderId = folderId;
    
            var uploadFile = new com.netsuite.webservices.File { attachFromSpecified = true, attachFrom = FileAttachFrom._computer };
    
            if (sFolderId != null)
            {
                var folderRef = new RecordRef { internalId = sFolderId };
                uploadFile.folder = folderRef;
            }
    
            // Specify the NetSuite filename
            if (sNsFileName != null)
                uploadFile.name = sNsFileName;
    
            uploadFile.fileTypeSpecified = true;
            if (sFileType != null)
            {
                if (sFileType.Trim().ToLower().Equals("plaintext"))
                    uploadFile.fileType = MediaType._PLAINTEXT;
                else if (sFileType.Trim().ToLower().Equals("image"))
                    uploadFile.fileType = MediaType._IMAGE;
                else if (sFileType.Trim().ToLower().Equals("csv"))
                    uploadFile.fileType = MediaType._CSV;
                else
                    uploadFile.fileType = MediaType._PLAINTEXT;
            }
            else
                uploadFile.fileType = MediaType._PLAINTEXT;
    
            uploadFile.content = LoadFile(sFileName);
    
            // Invoke add() operation to upload the file to NetSuite
            var response = Service.add(uploadFile);
    
            // Process the response
            if (response.status.isSuccess)
            {
                Console.WriteLine(
                    "\nThe file was uploaded successfully:" +
                    "\nFile Record key=" + ((RecordRef)response.baseRef).internalId +
                    "\nRenaming file");
            }
            else
            {
                Console.WriteLine("The file was not uploaded. Please notify the NetSuite team of the following error:");
                DisplayError(response.status.statusDetail);
    
            }
        }
    
        private static byte[] LoadFile(String sFileName)
        {
            byte[] data;
    
            try
            {
                FileStream inFile;
                using (inFile = new FileStream(sFileName, FileMode.Open, FileAccess.Read))
                {
                    data = new Byte[inFile.Length];
                    inFile.Read(data, 0, (int)inFile.Length);
                }
            }
            catch (Exception ex)
            {
                // Error creating stream or reading from it.
                Console.WriteLine(ex.Message);
                 return null;
            }
    
            return data;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how can i make java program working with multiple languages (frensh, english , arabic
I am working in android. I am designing a program to upload a file
I'm working on a web application import program. Currently an admin user can upload
Well, I have this program, the download option is working fine. I can access
Im working with a friend to recieve image uploads from his C# program to
I have a feature of my program where the user can upload a csv
I am working on a file upload system which will store individual parts of
I am working on a binary file transfer program in which the client has
is there any small working program for recieving from and sending data to client
I have a working program in C++ that generates data for a Mandelbrot Set.

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.