Here is my controller code:
def test_upload:
if request.vars.file1 is not None:
result = db(db.mytable.id==24).update(file1=request.vars.file1.file)
else:
result = 0
return dict(result=result)
status-5.png uploaded as
applications/myapp/uploads/mytable.file1/85/mytable.file1.8586ded7f7608eee.746d706c3176667666.txt
Thanks,
AT
On Tuesday, 13 August 2013 17:49:34 UTC+5, Anthony wrote:
>
> 'txt' is the default extension given if the filename doesn't match the
> following regex: '\.(?P<e>\w{1,5})$'. "picture.jpg" should match that
> regex, so something else is going on. Please show the full code used for
> the upload action as well as an actual filename that exhibits the problem.
>
> Anthony
>
> On Tuesday, August 13, 2013 8:33:35 AM UTC-4, at wrote:
>>
>>
>> picture.jpg changes to picture.txt, infact to a long encoded name:
>> mytable.file1.8cc66faf70ead672.746d70316a6c676677.txt
>>
>> Regards,
>> Atif
>>
>> On Tuesday, 13 August 2013 17:25:28 UTC+5, LightDot wrote:
>>>
>>> Does .txt actually replace an existing extension, or does it show up
>>> appended instead? What I mean is, does picture.jpg change into picture.txt
>>> or into picture.jpg.txt?
>>>
>>> Regards,
>>> Ales
>>>
>>> On Tuesday, August 13, 2013 12:10:40 PM UTC+2, at wrote:
>>>>
>>>>
>>>>
>>>> Hi,
>>>>
>>>> Please consider following model:
>>>> db.define_table('mytable',
>>>> Field('file1', type='upload', uploadseparate=True,
>>>> requires =
>>>> IS_EMPTY_OR(IS_UPLOAD_FILENAME(extension='pdf|jpg|png|gif|doc|docx|rtf|txt',
>>>>
>>>> error_message='Only PDF, Word Docs, RTF, Text & Images allowed')))
>>>> )
>>>>
>>>> When a file is uploaded using following form, file extention
>>>> automaticalyy changes to .txt:
>>>> <form id="upload_form" class="block-content form" action=""
>>>> method="post" enctype="multipart/form-data">
>>>> <input id="adm_file3" class="upload" type="file" name="file1">
>>>> <input id="attach_files" class="button" type="submit"
>>>> value="Attach File(s)">
>>>> </form>
>>>>
>>>> Any idea what could be the reason?
>>>>
>>>> Thanks
>>>>
>>>
--
---
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].
For more options, visit https://groups.google.com/groups/opt_out.