Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Monday, August 12, 2013 8:17 AM
Hello Everybody,
I'm glad to ask my first question on this community (many months following it).
Here my question:
I'm trying to convert a byte[] to HttpPostedFileBase, but it always returns Null (even if the byte[] contains data). Here the code I have:
public override bool IsValid(object value) {
HttpPostedFileBase file = value as HttpPostedFileBase}
That code is part of my IsValid function where I'm validating if the uploaded image is Valid (less than 1MB, just 'jpg' or 'png', etc.).
Thanks in advance.
All replies (3)
Monday, August 12, 2013 10:24 AM âś…Answered
Hi,
Try using the readbytes method
please check the following link
http://stackoverflow.com/questions/7852102/convert-httppostedfilebase-to-byte
Regards,
Stygen
Monday, January 11, 2016 2:53 AM
He asked how to convert from byte[] to HttpPostBasedFile, not the inverse. These links you provided explains how to convert from HttpPostBasedFile to byte[].
I have the same doubt and unfortunately these links didn't help me at all.
Thursday, March 3, 2016 12:51 PM
Did you find a solution? I'm having the same need...