Thanks!

On Thu, Sep 20, 2012 at 12:40 PM, Niphlod <[email protected]> wrote:

> let me explain better. You could write all the logic to store filenames on
> your custom folders and all the logic to retrieve (given a certan value)
> the file itself.
> But, you can skip most of the hassle while retaining some useful chunks of
> web2py code.
> 1) let web2py store the file "the way it does" so you don't have to come
> up with some weirdo code to avoid collision between similar names
> 2) store in the same table (another field) store the original filename/seo
> friendly filename
> 3) code a function that searches your table using the original/seo
> friendly filename. you get a row where with retrieve() you can return the
> file (contents). The name of the file is up to you, as is the "format" of
> the url you want to use for your "seo friendly" purposes.
>
>
>
> On Thursday, September 20, 2012 5:17:43 PM UTC+2, Tito Garrido wrote:
>
>> Just got a problem here... using first link I will put the filename on a
>> field image_filename but the image is not stored as image_filename... So
>> will probably need to create a download function that will query the
>> filename, return and return the web2py filename so I can use it on URL().
>> It is not nice but I guess it is the only way :(
>>
>> On Thu, Sep 20, 2012 at 12:09 PM, Tito Garrido <[email protected]>wrote:
>>
>>> 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.**myfi**le.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/**defaul**t/chapter/29/06#More-on-**upload**s<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-*
>>>>>>>> *or**iginal-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).:_______
>>>
>>
>>
>>
>> --
>>
>> Linux User #387870
>> .........____
>> .... _/_õ|__|
>> ..º[ .-.___.-._| . . . .
>> .__( o)__( o).:_______
>>
>  --
>
>
>
>



-- 

Linux User #387870
.........____
.... _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:_______

-- 



Reply via email to