Decoding file name.

36 views
Skip to first unread message

Prasad Muley

unread,
Jul 28, 2015, 9:05:58 AM7/28/15
to web2py-users
Hi All,

     file name gets store as 93f00342868f4085.73716c2e6c6f67.log in db field.
I've tried to decode it using base64 But didn't get the original file name.

Is there any way to decode it and get the original file name?



Limedrop

unread,
Jul 28, 2015, 4:13:32 PM7/28/15
to web2py-users, pmm...@gmail.com
You could try something like this:

    (filename, fullfilename) = db.tablename.uploadfield.retrieve(record.uploadfield, nameonly=True)

Anthony

unread,
Jul 28, 2015, 8:29:28 PM7/28/15
to web2py-users, rus...@holtrd.com, pmm...@gmail.com, rus...@holtrd.com
That's the easiest way. If you do want to decode the filename yourself, note the encoded filename is only the last segment of the new filename (i.e., the part after the last "." -- in this case, "73716c2e6c6f67").

Anthony

Dave S

unread,
Jul 28, 2015, 9:27:54 PM7/28/15
to web2py-users, rus...@holtrd.com, pmm...@gmail.com, abas...@gmail.com


On Tuesday, July 28, 2015 at 5:29:28 PM UTC-7, Anthony wrote:
That's the easiest way. If you do want to decode the filename yourself, note the encoded filename is only the last segment of the new filename (i.e., the part after the last "." -- in this case, "73716c2e6c6f67").


And
newname = ''
for c in filein:
  newname
= newname + "%x" % (ord(c))



rather than base64?

/dps

 
Reply all
Reply to author
Forward
0 new messages