我的服务器找到了文件路径,但它无法存储文件。 [英] My server found File path but It can not store file there.

查看:87
本文介绍了我的服务器找到了文件路径,但它无法存储文件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的网站上传文件。但是当我尝试上传文件时,服务器没有上传文件,但是服务器得到了正确的文件路径。这个代码在本地主机中运行良好。但是当我在网站上使用这个代码时会出现这个问题。



我的代码在这里。



I am trying to upload file in my site.but when I am trying to upload file, server does not upload file, However server got right filepath.This all code work nicely in local host. but this problem arise when I use this code for online site.

My code is here.

string FileName = FileUploader.PostedFile.FileName;
string path = Server.MapPath("~/BookImages/");
FileUploader.SaveAs(path + FileName);

推荐答案

首先想到的问题是:你为什么要使用文件名两次?



第二个可能是权限问题 - 您需要在主机上的BookImages文件夹上提供写入权限。 (在开发机器上没关系,因为已经给出了许可)
The first question which springs to mind is: why are you using the file name twice?

The second is probably a permissions problem - you need to give write permission on the BookImages folder on your host. (It doesn''t matter on the development machine, because the permission is already given)


这篇关于我的服务器找到了文件路径,但它无法存储文件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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