Upload files

36 views
Skip to first unread message

Константин Комков

unread,
Jun 22, 2019, 4:18:42 AM6/22/19
to web2py-users
I made upload form for files that winter and today when project is working 3 days user told me that he can't load file. When I saw that file it name was "name.JPG"  but in my code befor i find only .jpg. Now all is ok.
    for i in img:
        s = i.file[len(i.file)-5:len(i.file)]
        if ((s.find('.jpg')>-1) | (s.find('.JPG')>-1) | (s.find('.jpeg')>-1) | (s.find('.JPEG')>-1) | (s.find('.png')>-1) | (s.find('.PNG')>-1) | (s.find('.bmp')>-1) | (s.find('.BMP')>-1)):
            studDocs = studDocs + """<div id='doc"""+str(i.id)+"""' class="col col-pd"><div class="img-box"><img class="img" src='"""+URL('bak','download',args=i.file)+"""'/><div class='del-img'></div></div></div>"""
        elif ((s.find('.pdf')>-1) | (s.find('.PDF')>-1)):
            studDocs = studDocs + """<div id='doc"""+str(i.id)+"""' class="col col-pd"><div class="document"><p class="text-center expansion">.pdf</p><div class='del-img'></div></div></div>"""
        elif ((s.find('.tif')>-1) | (s.find('.TIF')>-1)):
            studDocs = studDocs + """<div id='doc"""+str(i.id)+"""' class="col col-pd"><div class="document"><p class="text-center expansion">.tiff</p><div class='del-img'></div></div></div>"""

uploadForm.png

Alex Beskopilny

unread,
Jun 22, 2019, 5:09:52 AM6/22/19
to web2py-users
if any ( ['.jpg' in file_name, '.JPG' in file_name ,  ....]  ):
?

суббота, 22 июня 2019 г., 11:18:42 UTC+3 пользователь Константин Комков написал:
Reply all
Reply to author
Forward
0 new messages