Reading content of a file uploaded by user
5 pts.
0
Q:
Reading content of a file uploaded by user
Hi everyone, new user here. I've been finding it harder and harder to get answers at EE for certain questions, and am hoping someone here will be able to help me!

Using asp.net and c#, my site allows users to save the innerhtml of a certain div to a file. Now I need the reverse.

Here's what I need: upon clicking a button, the user gets a "open file" dialog, which let him choose a file on his pc. Upon choosing it, the site reads the content of the file, and assigns it as the innerhtml of a div.

several points: 1) can this be done without saving the file to the server? I have no need for the actual file, just the contents of it.

2) I would ideally want the file to have a proprietary file extension, so the user doesnt by mistake upload a wrong file. I've been saving the file using

Response.ClearHeaders();
Response.ClearContent();
Response.AddHeader("content-type", "text/plain");
Response.AddHeader("Content-disposition", "attachment; filename=yourname.txt");
Response.Write(divTest.InnerHtml);
Response.Flush();
Response.End();

Can I use this for a proprietary file.extension?

3) Should I be worried about hacking? I.e. can someone put malicious code in the file which, upon loaded as the innerhtml of the div, will cause me havoc?

TIA!
ASKED: Jun 30 2009  9:03 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
5 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
Last Answered: Jun 30 2009  9:03 PM GMT by Feivi18   5 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



0