需要文件上传帮助 [英] File Upload Help Required

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

问题描述



我正在使用MVC3上传文件,一切正常.

我正在使用<input type="file">控件

出现的问题是,如果我上载文件名"abc.gif",而下次我上载相同的文件,则不是覆盖它,而是显示异常msg访问被拒绝进行上载.

上传是我放置文件的目录.

请告诉我如何处理.

关于

Hi,

I am uploading files using MVC3 all things are working fine.

I am using <input type="file"> control

The problem is arising that if I upload a file name "abc.gif" and next time I upload the same file, then instead of overwriting it is showing exception msg Access is denied to Uploads.

Uploads is the directory where I am placing my files.

Kindly tell me how can i handle this.

Regards

推荐答案

问题是您无权覆盖同一文件.要处理此问题,您应在上传后将文件移至其他位置.移动之前,请检查是否存在相同名称的文件.如果存在另一个具有相同名称的文件,则需要确定要执行的操作.
The problem is that you do not have access to overwrite the same file. To handle this you should move the file to another location after the upload. Before you move, you check if there is a file with the same name. If there is another file with the same name, you need to decide what you want to do.


阅读以下线程:
在服务器上的C#中重命名文件
使用ASP.NET MVC上传文件(或多个文件)
Read the following thread:
Renaming file in C# on Server
How can I upload a file and save it to a Stream for further preview using C#?

And an article:
Uploading a File (Or Files) With ASP.NET MVC


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

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