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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:34:22+00:00 2026-06-02T08:34:22+00:00

Title kind of says it all. When I am running this in localhost everything

  • 0

Title kind of says it all. When I am running this in localhost everything works fine, today I deployed to run some testing and BAM! not working. And I for some reason cannot enable the errors to display so I am not sure what is wrong, or really how to even debug this..

Here is the controller:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DarkRobot.Models;
using System.Web.Helpers;
using System.IO;

namespace DarkRobot.Controllers
{
[Authorize]
public class UploadController : Controller
{
    //
    // GET: /Upload/
    private DarkRobotEntities1 db = new DarkRobotEntities1();


    public ActionResult Index()
    {
        return View();
    }
    [HttpPost]
    public ActionResult Index(HttpPostedFileBase file, string name)
    {
        if (file != null && file.ContentLength > 0)
        {
            var fileName = Path.GetFileName(file.FileName);
            var path = Path.Combine(Server.MapPath("/Images"), fileName);
            file.SaveAs(path);

            Image image = new Image();
            image.RelativeLocation = "/Images/" + file.FileName;
            image.Title = name;
            db.Images.Add(image);
            db.SaveChanges();

        }
        return RedirectToAction("Confirm");
    }

    public ActionResult Confirm()
    {
        return View();
    }
}
}

And here is Index

@using (Html.BeginForm("Index", "Upload", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<input type="file" name="file" />
<br />
<input type="text" name="name" />
<br />
<input type="submit" value="OK" />
}

If there is anything else you need to try to figure this out, I will gladly update the question. I am fairly new to MVC..

  • 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-02T08:34:26+00:00Added an answer on June 2, 2026 at 8:34 am

    If the same code works in your development, I Strongly believe it is a permission issue. Make sure the directory you are trying to upload to, have sufficient permissions to write a file to that.

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

Sidebar

Related Questions

Title kind of says it all. I just can't seem to find a DictionaryOrDefault
Title kind of says it all. I have 2 tables Both with matching data
The title kind of says it all, I want items in a listbox to
this is kind of a strange title, so let me explain: We have a
This is kind of a weird question so my title is just as weird.
Horrible title, I know. I want to have some kind of wordwrap, but obviously
As the title mentioned, I want to encode a Image Obj into some kind
Title said it all. Some context: I got a search mechanism - search view,
Title pretty much says it all. The web.config, unchanged from how VS2008SP1 generated it,
I think my title about says it all. During the __construct() -tion of $classA

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.