使用 System.IO.Delete 从目录中删除某些文件?
我在名为 Pics 的文件夹中有 2 张图像...... Image1.jpg 和 Image2.jpg。
我必须在提交按钮中放置什么代码才能删除位于此处“~/Pics/Image1.jpg”的 Image1.jpg
任何帮助都会很棒!
I have 2 images inside a folder called Pics..... Image1.jpg and Image2.jpg.
What code must i place inside my Submit button to just delete Image1.jpg located here "~/Pics/Image1.jpg"
Any help would be great!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您需要使用 System.IO.File.Delete 不是 System.IO.Delete
You need to use System.IO.File.Delete not System.IO.Delete
语法是:
但是,您需要确保您的 Web 应用程序正在运行的用户对您要删除的文件具有删除(更改)权限。
The syntax is:
You will need to make sure the user your web app is running as has delete (change) permissions on the file you are deleting, however.
尝试这个:
Try This:
我会尝试:
i would try: