Live Server的文件上传问题 [英] File Upload Problem at Live Server

查看:97
本文介绍了Live Server的文件上传问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在开发和本地IIS服务器上对图像文件上传进行了完整的测试.在早期阶段,本地IIS服务器上存在访问问题.我将所有人授予图像文件夹"上的全部权利,问题已解决.
但是,当我在托管环境上上传相同的文件时,会产生运行时错误.我们的网站托管在Godady.根据我的想法,在我上传文件的文件夹中仍然存在访问问题.

文件上传代码如下:


I have Completely Tested Image File Upload at Development and Local IIS Server. At earlier Stages there was Access problems at the Local IIS Server. i give complete rights to everone on Images Folder and problem was resolved.
But When I uploaded same files at hosting Environment it produces Runtime Error. We have hosted our site at Godady. According to my thinking there is still Access issues on folder where I am uploading Files.

File Upload Code is as here


string TempPath = Server.MapPath("~\\Images");
DirectoryInfo thisFolder = new DirectoryInfo(TempPath);
if (!thisFolder.Exists)
{
    thisFolder.Create();
}
FileUpload1.PostedFile.SaveAs(TempPath + "\\" + FileUpload1.FileName);


错误看起来像这样
``/''应用程序中的服务器错误.
-------------------------------------------------- ------------------------------
运行时错误
说明:服务器上发生应用程序错误.该应用程序的当前自定义错误设置可防止出于安全原因而远程查看该应用程序错误的详细信息.但是,可以由运行在本地服务器计算机上的浏览器查看它.
详细信息:要使此特定错误消息的详细信息在远程计算机上可见,请创建一个< customerrors>位于当前Web应用程序根目录中的"web.config"配置文件中的标记.然后,此customErrors标记应将其模式"属性设置为关".



The Error looks like this
Server Error in ''/'' Application.
--------------------------------------------------------------------------------
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customerrors> tag within a "web.config" configuration file located in the root directory of the current web application. This customErrors tag should then have its "mode" attribute set to "Off".


<!-- Web.Config Configuration File --> 
<configuration> 
<system.web> 
<customerrors mode="Off" /> 
</system.web> 
</configuration> 

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customerrors> configuration tag to point to a custom error page URL. 

<!-- Web.Config Configuration File --> 
<configuration> 
<system.web> 
<customerrors mode="RemoteOnly" defaultredirect="mycustompage.htm" /> 
</system.web> 
</configuration>br mode="hold" />

Please Help me. Thanks in Advance
Azhar Iqbal</customerrors>

推荐答案

首先要在服务器更改时看到正确的错误消息

First Thing if want to see the proper error message on server change

<customerrors mode="RemoteOnly" defaultredirect="mycustompage.htm" /> 




To

<customerrors mode="Off" /> 



其次,如果您认为存在权限问题,则只需转到您的网站cpanel,然后将所有权限授予该文件夹即可.



Second if you feel that there is some permission problem then simple go to your websites cpanel and give all permission to that folder.


您应该授予您要存储图像的文件夹的权限,然后只有您自己不会出现任何错误
you should give permissions to the folder you are storing images then only you will not get any errors


这篇关于Live Server的文件上传问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆