c# - Uploading a text file in ASP.NET -


I have a web page on which users can upload text files (but a text file, i.e. file extension. Txt, many encodings, such as ASCII, UTF8, Unicode ... etc.), I am trying to validate the content before saving the file to disk, if the content is not valid, then I can not save it File. I am reading content from file upload control (file upload 1.file content which gives a stream of bytes), an easy way to convert contents of the uploaded file to string (ie, fileUpload1 Back-byte stream) .FileContent) Or should I first need to see the bytes first to find the encoding?

Thanks

I think you can:

  streamer reader = new streamrider (fileUpload1.FileContent); String text = reader Readout ();  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -