If you set the length attribute of the uploadfield the filename will be 
truncated accordingly. 
As jonathan says, the length of uploadfield is filesystem dependent. Set it 
to 128 or 256 to be safe.

On Friday, 6 July 2012 20:42:50 UTC-5, rochacbruno wrote:
>
> Hi!
>
> Recently, many users of a social site which uses Movu.ca (
> http://www.menuvegano.com.br) are trying to upload pictures taken from 
> facebook, and that pictures has long file names, which leads in to this 
> kind of error:
>
>  1.
> 2.
>
>
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
> 21.
> 22.
>
> Traceback (most recent call last):
>
>
>   File "/home/www-data/menuvegano/gluon/restricted.py", line 205, in 
> restricted
>
>
>     exec ccode in environment
>   File "/home/www-data/menuvegano/applications/init/controllers/article.py", 
> line 177, in <module>
>
>
>   File "/home/www-data/menuvegano/gluon/globals.py", line 175, in <lambda>
>
>
>     self._caller = lambda f: f()
>
>
>   File "/home/www-data/menuvegano/applications/init/controllers/article.py", 
> line 19, in edit
>
>
>     article = Article('edit')
>
>
>   File "applications/init/modules/handlers/base.py", line 41, in __init__
>
>
>     self.__getattribute__(hook)()
>
>
>   File "applications/init/modules/handlers/article.py", line 645, in edit
>
>
>     if self.context.article_form.process().accepted:
>
>
>   File "/home/www-data/menuvegano/gluon/html.py", line 2016, in process
>
>
>     self.validate(**kwargs)
>
>
>   File "/home/www-data/menuvegano/gluon/html.py", line 1963, in validate
>
>
>     if self.accepts(**kwargs):
>
>
>   File "/home/www-data/menuvegano/gluon/sqlhtml.py", line 1231, in accepts
>
>
>     newfilename = field.store(source_file, original_filename, 
> field.uploadfolder)
>
>
>   File "/home/www-data/menuvegano/gluon/dal.py", line 7897, in store
>
>
>     dest_file = open(pathfilename, 'wb')
>
> IOError: [Errno 36] File name too long: 
> '/home/www-data/menuvegano/applications/init/databases/../uploads/article.picture.924877f659848aee.706c7567696e5f636b656469746f725f75706c6f61642e75706c6f61642e626437613039353761353730316365382e35363635363736313665366632303664366637323631366536373666323036333666366432303633366636333666323032383331323932653461353034372e4a5047.JPG'
>
>
>
> Any thought about it?
>
>
> *Bruno Cezar Rocha*
>
> http://www.CursoDePython.com.br
> [image: Facebook] <http://facebook.com/rochacbruno> [image: 
> Twitter]<http://twitter.com/rochacbruno> [image: 
> LinkedIn] <http://linkedin.com/in/rochacbruno> [image: 
> about.me]<http://about.me/rochacbruno> [image: 
> Amazon] <http://amazon.com/author/rochacbruno> [image: 
> AngelList]<http://angel.co/rochacbruno> [image: 
> Blog RSS] <http://www.web2pyslices.com/slice/list.rss?author=1> [image: 
> Facebook Page] <http://facebook.com/CursoDePython> [image: 
> foursquare]<http://foursquare.com/rochacbruno> [image: 
> Google Plus] <https://plus.google.com/u/0/116110204708544946953/posts> 
> [image: 
> pinterest] <http://pinterest.com/rochacbruno> [image: 
> SlideShare]<http://slideshare.com/rochacbruno> [image: 
> YouTube] <http://youtube.com/user/brunovegan>
>  [image: Google Talk] rochacbruno [image: Skype] blouweb
> Blog: Generate a thumbnail that fits in a 
> box<http://www.web2pyslices.com/slice/show/1522/generate-a-thumbnail-that-fits-in-a-box>
>   Get a signature like this. 
> <http://r1.wisestamp.com/r/landing?promo=18&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18>
>  Click 
> here.<http://r1.wisestamp.com/r/landing?promo=18&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18>
>    
>
>  

Reply via email to