Thanks! I will try! On Thu, Sep 20, 2012 at 11:55 AM, Niphlod <[email protected]> wrote:
> What you are missing is that if you want to use webpy's facilities you > must "adapt" to its standards. > Web2py needs a "complicated" filename to be able to store it in the > uploads/ folder a file without overwriting it with new records (e.g. two > users submitting a file named "image.jpg", or different uploads on > different tables). > > If you want to make your own download function, you have all the pieces to > glue together what you need (store the original filename (on the first link > I provided), retrieve the file and serve that (the second link I provided)). > > Then, you can call myapp/defauly/myseodownloadof/image.jpg or whatever you > need. > > > On Thursday, September 20, 2012 4:27:55 PM UTC+2, Tito Garrido wrote: > >> I have did what is written on "More on Uploads": >> >> db.myfile.insert(image=db.**myfile.image.store(stream, filename)) >> >> >> But it uses the filename just to get the extension and save it using >> web2py naming convention... So I guess I can't use type upload field at all >> to avoid web2py naming convention... :( >> >> On Thu, Sep 20, 2012 at 11:19 AM, Niphlod <[email protected]> wrote: >> >>> no. in the scaffolding app the index/download function calls >>> response.download. However, it works only with the "original" naming scheme >>> of web2py. >>> >>> Given that you want "your own", you must save/alter the original >>> filename in another field of the table, and then write YOUR function to >>> retrieve the file (e.g. looking at the "altered/original" filename, not the >>> one set by web2py) and call response.stream on that file. >>> >>> Look into >>> http://web2py.com/books/**default/chapter/29/06#More-on-**uploads<http://web2py.com/books/default/chapter/29/06#More-on-uploads> >>> >>> for dealing with store() and retrieve(). >>> >>> >>> On Thursday, September 20, 2012 3:46:09 PM UTC+2, Tito Garrido wrote: >>> >>>> Thanks I have read it before but I didn't undertand... so I will be >>>> able to call the 'download' function using image_filename instead of >>>> image.image? >>>> >>>> Just to clarify I'd like to call a mnemonic filename due SEO >>>> optimizations. >>>> >>>> Regards, >>>> >>>> Tito >>>> >>>> On Thu, Sep 20, 2012 at 4:57 AM, Niphlod <[email protected]> wrote: >>>> >>>>> book! >>>>> >>>>> http://web2py.com/books/**defaul**t/chapter/29/07#Storing-**the-** >>>>> original-filename<http://web2py.com/books/default/chapter/29/07#Storing-the-original-filename> >>>>> >>>>> >>>>> On Thursday, September 20, 2012 4:47:54 AM UTC+2, Tito Garrido wrote: >>>>>> >>>>>> Hi, >>>>>> >>>>>> Is there a way to use the original filename on a upload field or >>>>>> custom filenames? I guess it is possible since we can upload files in >>>>>> appadmin and choose the name but I couldn't find how to do it. >>>>>> >>>>>> Thanks in advance, >>>>>> >>>>>> Tito >>>>>> >>>>>> -- >>>>>> >>>>>> Linux User #387870 >>>>>> .........____ >>>>>> .... _/_õ|__| >>>>>> ..º[ .-.___.-._| . . . . >>>>>> .__( o)__( o).:_______ >>>>>> >>>>> -- >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>>> -- >>>> >>>> Linux User #387870 >>>> .........____ >>>> .... _/_õ|__| >>>> ..º[ .-.___.-._| . . . . >>>> .__( o)__( o).:_______ >>>> >>> -- >>> >>> >>> >>> >> >> >> >> -- >> >> Linux User #387870 >> .........____ >> .... _/_õ|__| >> ..º[ .-.___.-._| . . . . >> .__( o)__( o).:_______ >> > -- > > > > -- Linux User #387870 .........____ .... _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:_______ --

