If the web project and the .txt file are running on the same machine, they can be read directly using the absolute path. If they are passed to the web project, they can be read using the relative path
1. You can upload it to the Web project, which means you can get the InputStream. So what should you do first to read the file? Take InputStream. 2. What can you do with the InputStream of txt? You can save the file and read its content. 3. You can read its content. Why not save it directly?
Do you feel that you don’t quite understand the above? This is how I feel when I read the question you asked
Your question is too vague. Please ask more clearly. I don’t know what you are asking
1. By reading a file on the hard disk, format its content and save it into the database ('Now we need to convert the local The obtained .txt file directly reads the content and inserts it into the database. ')
2. By reading a file on the hard disk, upload its content to the server, and the server directly reads the file content and stores it into the database. 3. Pass Read a file from the hard disk and upload its content to the server. The server first saves the file, then reads its content, and then saves it to the database
If the web project and the .txt file are running on the same machine, they can be read directly using the absolute path.
If they are passed to the web project, they can be read using the relative path
1. You can upload it to the Web project, which means you can get the InputStream. So what should you do first to read the file? Take InputStream.
2. What can you do with the InputStream of txt? You can save the file and read its content. 3. You can read its content. Why not save it directly?
Do you feel that you don’t quite understand the above? This is how I feel when I read the question you asked
Your question is too vague. Please ask more clearly. I don’t know what you are asking
1. By reading a file on the hard disk, format its content and save it into the database ('Now we need to convert the local The obtained .txt file directly reads the content and inserts it into the database. ')2. By reading a file on the hard disk, upload its content to the server, and the server directly reads the file content and stores it into the database. 3. Pass Read a file from the hard disk and upload its content to the server. The server first saves the file, then reads its content, and then saves it to the database
I believe you want 2