On Wednesday, August 28, 2019 at 11:05:11 AM UTC-7, Rahul wrote:
>
> Hi Dave,
>
> upload_pic is the form variable that user specifies for uploading the file
> from local disk. Basically it is the filename. I removed the braces for
> outfile = (thumbpath)
> but this is still not working. Any more suggestions ?
>
>
> Regards
> Rahul
>
>
Your code looks overly complicated, and mixes methods (string
concatenation, os-specific separators, and os.path.join()).
I'd try what I think is clearer, simpler, and should work on both Windows
and Linux.
foto_path = os.path.join(request.folder,
"static",
"user_uploads",
upload_pic)
thumbnail_filename = "%s.thumbnail.jpg" % recordsID
thumbpath = outfile = os.path.join(request.folder,
'static',
'thumbs',
thumbnail_filename)
and the only reason I have both thumbpath and outfile is because you use
both later on (in the db update and in the thumbing process,
respectively). Ditto foto_path and infile. Also, infile and outfile can
never be the same even with your constuctions, because "thumbs" !=
"user_uploads".
Note: I have made plenty of use of os.path.join() on Linux and on Windows
(different apps), and have never had problems with random changes in the
filenames.
/dps
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/68d588ef-0074-4678-aedf-1398f4722a16%40googlegroups.com.