Answer the question
In order to leave comments, you need to log in
Is it possible to write the file received through the socket to the database?
Subject. We accept a file (server), something like this:
byte[] buffer = new byte[64*1024];
FileOutputStream outF = new FileOutputStream(fileName);
int count, total = 0;
while ((count = din.read(buffer)) != -1){
total += count;
outF.write(buffer, 0, count);
if(total == fileSize){
break;
}
}
Answer the question
In order to leave comments, you need to log in
Most often, the file is saved to disk, and only the path to it is "thrown" into the database. But in some cases it makes sense to store the received data entirely in the database, use BLOBs for this .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question