0

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?
Robert Cardona
  • 1,068
  • 5
  • 18
  • 31

1 Answers1

1

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.

Tomas Grosup
  • 6,396
  • 3
  • 30
  • 44
  • Relatively small: One random set gave 49.7 kB. Would I be able to just upload `main.dat` and have my program access the other needed files and add them to the dictionary? In any case, can you give an example of how this would work? or a link to an example? Thanks! (My ultimate goal is to just click on `main.dat` and have the program pull the other files.) – Robert Cardona Sep 03 '13 at 16:36
  • I believe that the browser will not allow you to access a file which hasn't been selected by the user, you won't be even able to see the path of the file. – Tomas Grosup Sep 03 '13 at 16:50
  • The user will have to select all of the files. – Tomas Grosup Sep 03 '13 at 16:51
  • But if I select `main.dat` it tells me the path in the `include file-a.dat`. It is assumed that they are all in same folder next to each other. Does that change anything? -- Edit: So by selecting all the files, we give the browser implicit permission to access those files, would I be able to select one, then have my code 'get' the other files and ask the user for explicit permission to access those? – Robert Cardona Sep 03 '13 at 16:52
  • As this http://stackoverflow.com/a/8282248/1160340 indicates, after selecting the files in Silverlight you get an collection of FileInfo objects, which already have the permission to read. – Tomas Grosup Sep 03 '13 at 17:00