C# 部署后不显示static.gif
我的MVC web应用程序上有一个上载按钮,允许用户上载文件。此文件上载到系统上,并对此文件执行一些C# 部署后不显示static.gif,c#,asp.net,asp.net-mvc,amazon-web-services,C#,Asp.net,Asp.net Mvc,Amazon Web Services,我的MVC web应用程序上有一个上载按钮,允许用户上载文件。此文件上载到系统上,并对此文件执行一些async操作,这可能需要1/2分钟。当用户按下上载按钮时,我希望processing.gif显示,直到上载完成。这在本地运行良好(当用户点击upload时,.gif会出现,直到上传完成),但当我部署到AWS elastic beanstalk时,.gif不会出现。谁能告诉我为什么 上传视图: <h4><strong></strong></h4>
async
操作,这可能需要1/2分钟。当用户按下上载按钮时,我希望processing.gif显示,直到上载完成。这在本地运行良好(当用户点击upload时,.gif
会出现,直到上传完成),但当我部署到AWS elastic beanstalk
时,.gif
不会出现。谁能告诉我为什么
上传视图:
<h4><strong></strong></h4>
<div class="row">
<div class="col-md-6 col-md-offset-4">
<div>
<p><strong>Upload Surveys for @Model.OfficialSchoolName in .PDF format</strong></p>
<br />
<form id="upload" class="btn btn-default" method="post" enctype="multipart/form-data" action="@Url.Action("Upload", "CompletedCamps")" onsubmit="document.getElementById('loading').style.display='block'">
<div>
<input name="file" type="file" class="btn btn-link" required />
<br />
<button type="submit" class="btn btn-block btn-primary">Import</button>
</div>
</form>
</div>
<br />
<br />
<div style="text-align: center;">
<img id="loading" src="../../Content/processing.gif" alt="Updating ..." style="display:none;" />
</div>
<br />
</div>
</div>
[HttpGet]
public ActionResult Upload(int? id)
{
CompletedCamp completedCamp = db.CompletedCamps.Find(id);
return View(completedCamp);
}
[HttpPost]
public async Task<ActionResult> Upload(HttpPostedFileBase file, int? id)
{
CompletedCamp completedCamp = db.CompletedCamps.Find(id);
string filename = Guid.NewGuid() + Path.GetExtension(file.FileName);
string filepath = Server.MapPath(Path.Combine("~/Surveys/", filename));
file.SaveAs(filepath);
await AzureVisionAPI.ExtractToTextFile(filepath);
ParseSurveyText parse1 = new ParseSurveyText();
await Task.Run(() => parse1.ParseTextFile(completedCamp.RollNumber, completedCamp.OfficialSchoolName, completedCamp.Date));
return View();
}
以.PDF格式上传@Model.OfficialSchoolName的调查结果
进口
控制器:
<h4><strong></strong></h4>
<div class="row">
<div class="col-md-6 col-md-offset-4">
<div>
<p><strong>Upload Surveys for @Model.OfficialSchoolName in .PDF format</strong></p>
<br />
<form id="upload" class="btn btn-default" method="post" enctype="multipart/form-data" action="@Url.Action("Upload", "CompletedCamps")" onsubmit="document.getElementById('loading').style.display='block'">
<div>
<input name="file" type="file" class="btn btn-link" required />
<br />
<button type="submit" class="btn btn-block btn-primary">Import</button>
</div>
</form>
</div>
<br />
<br />
<div style="text-align: center;">
<img id="loading" src="../../Content/processing.gif" alt="Updating ..." style="display:none;" />
</div>
<br />
</div>
</div>
[HttpGet]
public ActionResult Upload(int? id)
{
CompletedCamp completedCamp = db.CompletedCamps.Find(id);
return View(completedCamp);
}
[HttpPost]
public async Task<ActionResult> Upload(HttpPostedFileBase file, int? id)
{
CompletedCamp completedCamp = db.CompletedCamps.Find(id);
string filename = Guid.NewGuid() + Path.GetExtension(file.FileName);
string filepath = Server.MapPath(Path.Combine("~/Surveys/", filename));
file.SaveAs(filepath);
await AzureVisionAPI.ExtractToTextFile(filepath);
ParseSurveyText parse1 = new ParseSurveyText();
await Task.Run(() => parse1.ParseTextFile(completedCamp.RollNumber, completedCamp.OfficialSchoolName, completedCamp.Date));
return View();
}
[HttpGet]
公共操作结果上传(int?id)
{
CompletedCamp CompletedCamp=db.CompletedCamps.Find(id);
返回视图(completedCamp);
}
[HttpPost]
public async Task您的img
标记具有style
属性和display:none
值。这就隐藏了processing.gif
它看起来像是提交表单时应该显示processing.gif
的javascript。它还没有与其他代码一起部署?感谢您的回复。抱歉,我遗漏了:onsubmit=“document.getElementById('loading').style.display='block'”-当用户按upload时,它会显示.gif,这在本地非常有效。我编辑了我的文章,其中的图片显示了在您添加的图像上按upload按钮时显示的内容。我可以看到,processing.gif
本身没有找到。img
标记在那里,但它找不到gif。您需要在src
属性中指定gif的正确路径。部署后,gif是否在AWS的内容文件夹中?部署后检查内容文件夹的最简单方法是什么?这将是登录AWS服务器并查找文件夹以查看gif是否在其中。您部署到的站点上是否显示其他图像/GIF?可能您需要更改路径。/../Content/processing.gif
。可能是gif位于AWS上的另一个文件夹中。。