有计算机上ASP.NET C#Web表单访问多个文件 [英] Have ASP.NET C# web form access multiple files on computer

查看:93
本文介绍了有计算机上ASP.NET C#Web表单访问多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文件,把它叫做 main.dat 。它里面有一个像线包括文件a.dat 包括文件b.dat 和我有逻辑手柄这些输入。我想能够上传 main.dat 通过asp.net(C#)Web表单项目,并把它接入文件a.dat 这应该是在同一个文件夹中。如果我使用像Silverlight的多文件的上传,那么它需要所有的人(排名不分先后),并接一个,在我无法控制的顺序,我想是在相同的顺序包括读取它们在一个在 main.dat


  1. 有没有直接解决这个问题的一种方式,即只需上传 main.dat 和有我的code访问指定的文件? (我知道这是一个长镜头,因为这可能会引起这么多的安全问题),如果不是,

  2. 有没有一种方法,我可以使用 Silverlight的多文件的上传(也许通过JavaScript)这样我就可以给指定的输入文件的顺序?就像如果文件b.dat 需要文件d.dat东西文件d.dat 实际上包括,然后进行一个第一次看?

  3. 任何备用(更好的)解决方案比两个我想过吗?


解决方案

有多大的文件?你能负担得起上传所有这些,甚至是不会最终被引用的人?

如果他们是小,你可以将它们保存到 Dictionairy<字符串MemoryStream的> 和排序&安培;在内存中处理它们。

I have a file, call it main.dat. Inside it has lines like include file-a.dat, include file-b.dat and I have logic that handles these inputs. I would like to be able to upload main.dat via asp.net (C#) web forms project, and have IT access file-a.dat which should be in the same folder. If I use something like silverlight-multifile-uploader, then it takes all of them (in alphabetical order) and reads them in one by one, in which I cannot control the order, which I want to be in the same order as the includes are in main.dat.

  1. Is there a way to solve this problem directly, i.e., just upload main.dat and have my code access the specified files? (I know this is a long shot since this could cause SO many security issues) and if not,
  2. Is there a way I can use the silverlight-multifile-uploader (maybe via javascript) so that I can specify the order given the input files? Like if file-b.dat needs something in file-d.dat and file-d.dat was in fact included, then make that one the first one read?
  3. Any alternate (better) solutions than the two I've thought of?

解决方案

How big are the files? Can you afford uploading them all, even the ones which wont be referenced in the end?

If they are small, you can save them to Dictionairy<string,MemoryStream> and sort & process them in memory.

这篇关于有计算机上ASP.NET C#Web表单访问多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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