Welcome to DU! The truly grassroots left-of-center political community where regular people, not algorithms, drive the discussions and set the standards. Join the community: Create a free account Support DU (and get rid of ads!): Become a Star Member Latest Breaking News Editorials & Other Articles General Discussion The DU Lounge All Forums Issue Forums Culture Forums Alliance Forums Region Forums Support Forums Help & Search

DaveJ

(5,023 posts)
4. Still having trouble, with server side
Tue Dec 20, 2011, 10:34 AM
Dec 2011

This is turning out to be a very undocumented procedure. Or maybe I'm just not seeing it. I created a page called GetMobileImage.aspx and placed the method below into it. But I can't figure out what to do from there. I'd expect something would go into the Page_Load method, to receive the transfer on the server side, but so far, I have not found any clear instructions online, just bits and pieces.

I'll keep trying, and definitely get back when I figure this out. It's probably so straightforward that nobody else is bothering to ask.

I'm thinking about uploading to some service like Photobucket, but the images would be better off on my own server.

Thanks.


private byte[] GetFileByteArray(string filename)
{
FileStream oFileStream = new FileStream(filename, FileMode.Open, FileAccess.Read);

// Create a byte array of file size.
byte[] FileByteArrayData = new byte[oFileStream.Length];

//Read file in bytes from stream into the byte array
oFileStream.Read(FileByteArrayData, 0, System.Convert.ToInt32(oFileStream.Length));

//Close the File Stream
oFileStream.Close();

return FileByteArrayData; //return the byte data
}

Recommendations

0 members have recommended this reply (displayed in chronological order):

Latest Discussions»Retired Forums»Website, DB, & Software Developers»Android code instructions...»Reply #4