Reputation: 95
In my project I have receiving multiple files using request.FILES.getlist('filedname')
and saving it using django forms save
method. Again reading the same files using tika
server api of python:
def read_by_tika(self, path):
'''file reading using tika server'''
parsed = parser.from_file(str(path))
contents = (parsed["content"].encode('utf-8'))
return contents
Is there any way to directly put list files getting from request.FILES
to tikka
server without saving it on hard disk.
Upvotes: 1
Views: 273
Reputation: 30522
If the files are small, try using tika's .from_buffer()
with file.read()
. However, files over 2.5 MBs are anyway saved to temporary files by django, see Where uploaded data is stored. In this case use read_by_tika(file.temporary_file_path())
. See also file upload settings
Upvotes: 2