Hi Massimo,

Still has this issue... :(

I am using 2.14.6 web2py running in windows7 with pydal 17.03 and python 2.7


I have this filename 54 characters (including '.pdf ')




This is the field on my db.py


After i add a record including an upload file  this is the Error

Adding record including upload file




Need help on resolving this issue since i cannot control the filename 
length of the user will upload
Also i check the length newfilename length and including its path hope it 
helps




The error is directing to this file



I also tried changing my field with length value but still error upon 
adding files with upload


Thank you in advance,
Jak




On Tuesday, July 21, 2015 at 10:41:55 PM UTC+8, Massimo Di Pierro wrote:
>
> web2py renames the uploaded filenames as tablename+code+hash.extension
>
> The total len(tablename+code+hash+extension)<=512
> This means len(hash) <= 512 - len(tablename+code+extension)
> The hash is a base64 encoded of the original filename.
> If this hash exceeds 512 - len(tablename+code+extension) the file is 
> truncated.
> Mind this is still a lot of characters.
>
> Massimo
>
>
> On Monday, 20 July 2015 20:36:50 UTC-5, Scott Hunter wrote:
>>
>> Is this an oversight or a conscious decision?  If I understand you, if 
>> one's filesystem allowed filenames greater than 512 characters, long-enough 
>> but still legal names will still be truncated, and thus thwart the ability 
>> to extract the original file name.  That could be a nasty surprise.
>>
>> P.S. As I understand it, it is a permanent filename.
>>
>> On Monday, July 20, 2015 at 8:47:36 AM UTC-4, Massimo Di Pierro wrote:
>>>
>>> Nowhere. We only state that Field(..., lenght=....) is a parameter. We 
>>> do not say that for "upload" fields this is also the length of the tmp 
>>> filename.
>>>
>>> On Monday, 20 July 2015 05:28:02 UTC-5, Scott Hunter wrote:
>>>>
>>>> Where is this spelled out in the documentation?  I could not find it.
>>>>
>>>> - Scott
>>>>
>>>> On Monday, July 20, 2015 at 2:24:24 AM UTC-4, Massimo Di Pierro wrote:
>>>>>
>>>>> This is handled by web2py. The filenames are truncated according to 
>>>>> the size of the uploadfield. This defaults to 512. In new versions of 
>>>>> windows the make file length has been reduced so you have to do
>>>>>
>>>>> Field(name, 'upload', size=200)
>>>>>
>>>>> and all filenames will be limited to 200 bytes.
>>>>>
>>>>> On Sunday, 19 July 2015 21:06:42 UTC-5, Scott Hunter wrote:
>>>>>>
>>>>>> This is not only an issue with Windows; any filesystem with a 
>>>>>> filename limit (however big) can hit this problem.  As this is all being 
>>>>>> handled by web2py, and the user is selecting the file to upload, where 
>>>>>> would this "logic" go, and why isn't web2py handling it?
>>>>>>
>>>>>> - Scott
>>>>>>
>>>>>> On Saturday, March 16, 2013 at 1:04:28 PM UTC-4, Niphlod wrote:
>>>>>>>
>>>>>>> I was wrong. the first part of the "hash" is a uuid, the second is a 
>>>>>>> base16 encoding of the original filename.
>>>>>>>
>>>>>>> Seems that you need some logic to cut down long files if you plan to 
>>>>>>> host on Windows.
>>>>>>>
>>>>>>> http://web2py.com/books/default/chapter/29/07?search=uploads#Storing-the-original-filename
>>>>>>>  
>>>>>>> <http://www.google.com/url?q=http%3A%2F%2Fweb2py.com%2Fbooks%2Fdefault%2Fchapter%2F29%2F07%3Fsearch%3Duploads%23Storing-the-original-filename&sa=D&sntz=1&usg=AFQjCNHoAJ_7v4pFTQfLJ7w7itNYEBhoPw>
>>>>>>>
>>>>>>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to