Im using a JQUERY based file uploader and obviously as other file uploaders it posts the data to server. Am using Generic handler to handle the data.
When I use
Context.request.files(0).saveAs(mpath)
It works fine. If its image, it keeps as image in the server keeping all its exif, meta data and everything. Same as if it is any other types, the file doest not loses its basic instinct or content type.
But due to some situational factors Im using Inputstream
So my code is
Dim inputStream As System.IO.Stream = context.Request.InputStream
Using fileStream As System.IO.FileStream = System.IO.File.OpenWrite(tempFile)
inputStream.CopyTo(fileStream)
End Using
But in this case the files behaves as an unknown file. Loses all its features or content type.
So what I guess is when using inputstream way, it losing its header.. (Not sure thats the reason)
So how can we avoid this and the file to keep all its extra info and type when using Stream