Author: kettch19 | Posted on: 10/1/2009 3:04:31 PM | Views : 341

Does anyone have an example (or know of one) of encrypting a file selected with a FileUpload control? I know that you can access the FileUpload.PostedFile.InputStream and encrypt that InputStream.
The problem I foresee is that I don't want to replace the original file with the encrypted one (i.e. same file name and path) but the FileUpload control's FileName property is ReadOnly. So even if you were able to encrypt the InputStream to another temp file, there doesn't appear to be a way to point the FileUpload control to the encrypted file prior to calling SaveAs to actually execute the upload.
A possible solution might be to rename the original file, encrypt it to a new file with the original filename, execute SaveAs, delete the encrypted file and rename the original file back to the original name, but that seems pretty hackish and file permission errors and such.

Anyone have insight on this?



...

Go to the complete details ...