Yes, no problem at all.
But you need to split the image in multiple packets, in order to keep the network bandwith stable.
First you need to know how to copy files byte for byte:
copyFile("my_image.jpg", "duplicate_image.jpg")
end
function copyFile(fileName$, newName$)
// open the two files
sourceFile = OpenToRead(fileName$)
destFile = OpenToWrite(newName$)
// while we are not at the end of the source file
while FileEOF(sourceFile) = 0
// write the next byte in the source file to the dest file
// by going through it byte by byte, this function will be able to copy any file, regardless of format
WriteByte(destFile, ReadByte(sourceFile))
endwhile
// close the files
CloseFile(sourceFile)
CloseFile(destFile)
endfunction
Now the idea is, to read the image as some chunks of bytes and then post the byte sequence over the net. (Sort of sourceFile)
The other side just merges the bytes to a new file. (like destFile, in the example)
Keep in mind, that you will have to build some sort of recieve Buffer array, because the media can be corrupted if a package wont be recieved.
So you got an array with byte chunks and chunk[34] is empty for example when you finished the recieve process, so you need to request the byte from chunk[34] again, to get a full working media file.
Process:
1. Connect to server
2. Request media file
3. Server sends amount of bytes for the media file (and also the chunk size)
4. Client creates buffer array based on the amount of bytes.
5. Server starts sending chunks of byte data including a header identifier for the buffer array (the chunk size is dependent on the maximal amounts of bytes per networkmessage, and the network bandwith)
6. Client saves chunks into buffer array
7. Once the last chunk is sent, the client checks for integrity (are all bytes recieved, is every array chunk filled?)
8.1. If not, then the client requests a specific missing chunk
8.2 If yes, the file transfer is completed, the media file can be saved from the buffer array.
9. Finished
If you got really small .jpg images, and a stable network, you won't need a recieve buffer.
Only if you want to go big...