Reputation: 46
I am setting up a flask server where the user has to upload a folder with files. (I am already sure the files have correct format) The folder is shared using Samba. Server is where files are uploaded and where they are processed. Client is where files are stored. Server and client are Ubuntu. The folder can contain a lot of files (1300 or more).
My code Option 1
html:
<form method="post" action="/upload" enctype="multipart/form-data">
<input type="file" name=dir webkitdirectory directory multiple/>
<input type="submit" value="Process Files"/><br/>
</form>
Python:
all_files = request.files.getlist('dir')
print(all_files)
if all_files == []:
print("No file found")
I also tried Option 2 html:
<form method="post" action="/upload" enctype="multipart/form-data">
<input type="file" multiple="" name="file[]" /><br />
<input type="submit" value="Process Files" >
</form>
Python:
all_files = request.files.getlist('file[]')
print(all_files)
if all_files == []:
print("No file found")
Option 1 works with folder located on the server but using shared folder html seems working fine (folder found and seems uploaded) but Python gives "No file found"
Option 2 works also with shared folder but I get two issues: 1 I have to select all files in the folder in friendly way, I cannot ask to the user to press ctrl+A 2 It works ONLY if I select a subset of files in the folder. I need to upload 1300 files and it seems not working with all the files togheter
Suggestion?
Upvotes: 1
Views: 1134
Reputation: 46
Thanks anyone but I found the issue cause. It was related to number of file managed from OS of client and server. I fixed looking at https://unix.stackexchange.com/questions/366352/etc-security-limits-conf-not-applied/370652#370652?newreg=f022beb3f52d4d7eaecbe4b19de751dd
Upvotes: 1