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

  • Home
  • SEARCH
  • 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 8130769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:50:48+00:00 2026-06-06T08:50:48+00:00

I have a file, which the users browse and hit the upload button, i

  • 0

I have a file, which the users browse and hit the upload button, i save the file on the server, appdata/uploads in the application directory. then i try to read it using stream reader and then parse it. on my local development enviornment it works fine, but when i deploy it on a server it does not work at all. any suggestions?? thank you

//Save LoadList File:
            DateTime uploadDate = DateTime.Now;
            string destinationPath = string.Format("{0}\\{1}\\{2}\\{3}\\", Server.MapPath("~/App_Data/uploads"), uploadDate.ToString("yyyy"), uploadDate.ToString("MMM"), uploadDate.ToString("dd"));
              if (!Directory.Exists(destinationPath))
                    Directory.CreateDirectory(destinationPath);

              string storedFileName = string.Format("{0}{1}.json", destinationPath, System.Guid.NewGuid());
                file.ElementAt(0).SaveAs(storedFileName);

           //FileImport is a static class
          var Pair = FileImport.CyclesCompleted(storedFileName);





           private static string LoadTextFromFile(string fileName)
                {
                    StreamReader streamReader = new StreamReader(fileName);
                    string text = streamReader.ReadToEnd();
                    streamReader.Close();
                    return text;
                }
  • 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-06T08:50:50+00:00Added an answer on June 6, 2026 at 8:50 am

    Saving file on server ususlly results in permission errors since most accounts can’t write to default location on server. You may get away with using Path.GetTempFileName, but even in this case some accounts (i.e. account that requests run for “anonymous user”) will not have permissions to read/write to that location.

    If you simply need to parse uploaded file you can copy stream to MemoryStream and create StreamReader over this memory stream. You may be able to use Stream for uploaded file directly, but it will not support seaking (may work as you are using StreamReader which does not seek).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a View in which the user is able to upload a file
I have a very simple page with which a user uploads a file. Using
I have a WordPress site, in which type1 users can upload *.doc files and
I have a Controller which allows users to download a file. The problem is
I have a pretty standard upload form - user picks a file, then hits
I have a simple cpp file which uses GIO. I have stripped out everything
I have a python file testHTTPAuth.py which uses module deliciousapi and is kept in
I have a java file Test.java (below) which uses Guava's HashMultiMap (downloaded from http://code.google.com/p/guava-libraries/
I have a Testing project that contains a csv file which a webtest uses
I have a Visual Studio project which uses nmake to call a Python file

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.