用webclient实现无空间上传文件错误:Could not find a part of the path .....

今天要在网站上面做一个批量上传的工具,但是不想用控件上传,感觉好麻烦,所以就在网上找了些资料,后来发现这种功能是可以实现下面我贴出代码:

这个是在aspx.cs页面的代码:

Code

这个代码在本地是可以实现的,但是我编译后放在服务器上就不能用了,

说明一下:我是根据上传空间选中的文件来判断文件夹的,然后上传这个文件夹中的所有图片,本地一点问题也没有,到服务器上就会报如下错误

错误为:

Server Error in '/' Application.

Could not find a part of the path 'E:\1233566\AT005611.jpg'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'E:\1233566\AT005611.jpg'.

Source Error:


An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

这个错误蛮奇怪的,如果是服务器的权限,到没什么,但是确实我本地的文件夹,不需要的呀!

有没人做过类似的东西,请教一下!

原文地址:https://www.cnblogs.com/Longkin/p/1294043.html