简体   繁体   English

让ASP.NET C#Web表单访问计算机上的多个文件

[英]Have ASP.NET C# web form access multiple files on computer

I have a file, call it main.dat . 我有一个文件,称为main.dat Inside it has lines like include file-a.dat , include file-b.dat and I have logic that handles these inputs. 它的内部有诸如include file-a.datinclude file-b.dat而我有处理这些输入的逻辑。 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. 我希望能够通过asp.net(C#)Web窗体项目上载main.dat ,并具有IT访问file-a.dat ,该file-a.dat应位于同一文件夹中。 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 . 如果我使用诸如silverlight-multifile-uploader之类的东西,则将它们全部(按字母顺序)并逐一读取,而我无法控制该顺序,而我希望该顺序与包括在main.dat

  1. Is there a way to solve this problem directly, ie, just upload main.dat and have my code access the specified files? 有没有一种方法可以直接解决此问题,即仅上传main.dat并让我的代码访问指定的文件? (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? 有没有一种方法可以使用silverlight-multifile-uploader (也许通过javascript),以便可以指定给定输入文件的顺序? 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? 就像如果file-b.dat需要在file-d.dat中包含某些内容,并且实际上包含了file-d.dat ,那么将其作为第一个读取的内容吗?
  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. 如果它们很小,则可以将它们保存到Dictionairy<string,MemoryStream>并在内存中对它们进行排序和处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM