Rank: Newbie Groups: Member
Joined: 6/24/2008 Posts: 4
|
I am trying to get the FileContent of a file(as a stream object similar to the MS FileUpload.FileContent Method) on the Client without using FileOpen method(as the client will not allow permissions on the Client Directory). I tried the following code:
private Stream FileContent(string FileName) { //Stream filestream = new FileStream(FileName, FileMode.Open); Stream filestream = new StreamReader(FileName).BaseStream;
return filestream; }
But the File that is uploaded is always corrupt. Is there any way to it? I don't want to use Final file location as I am using a web service to store the files in a File Repository.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
new FileStream(FileName, FileMode.Open)
should be correct. We are not aware of any problem with file being corrupted. So you might want to check the file manually first with file explorer first. Once you are sure the files are correct, you can then proceed to call your other code. If the problem continues, please post the page online and also make both the test file you use and the uploaded files accessible to us. We can then take a look and see what we can find.
Thanks!
|