Hi again, I have found out as follows after twiking with the dhtmlx framework. I am not sure how o access the actual image, i have noticed the file is an instance of something...not a file per say. i have the following results:
print type(file) type: <type 'instance'> print dir(file) dir: ['FieldStorageClass', '_FieldStorage__file', '_FieldStorage__write', '__contains__', '__doc__', '__getattr__', '__getitem__', '__init__', '__iter__', '__len__', '__module__', '__nonzero__', '__repr__', 'bufsize', 'disposition', 'disposition_options', 'done', 'file', 'filename', 'fp', 'getfirst', 'getlist', 'getvalue', 'has_key', 'headers', 'innerboundary', 'keep_blank_values', 'keys', 'length', 'list', 'make_file', 'name', 'outerboundary', 'qs_on_post', 'read_binary', 'read_lines', 'read_lines_to_eof', 'read_lines_to_outerboundary', 'read_multi', 'read_single', 'read_urlencoded', 'skip_lines', 'strict_parsing', 'type', 'type_options'] print file file: FieldStorage('file', 'power.gif', 'GIF87a\x1f\x02c\x01w\x00\x00!\xfe\x1aSoftware: Microsoft Office\x00,\x00\x00\x00\x00\x1f\x02c\x01\x87\xf7\xde{\xff\xef\xa5\xef\xbdZ\xf7\xd6s\xf7\xce{\xff\xe6\x94\xe6\xbdZ\xe6\xb5Z\xef\xc5Z\xde\xbdk\xf7\xe6\x94\xf7\xe6{\xff\xf7\xb5\xf7\xcek\xef\xbdk\xd6\x9cR\xf7\xd6\x8c\xb5{!\xe6\x9cB\xd6\xadZ\xef\xcek\xef\xb5Z\xef\xadJ\xd6\x9c1\xff\.....etc...too long to display I looked at the PHP implementation which looks as follows: $filename = $_FILES["file"]["name"]; move_uploaded_file($_FILES["file"]["tmp_name"], "uploaded/".$filename); What would be the equivalent in python? On Mon, Feb 24, 2014 at 4:41 PM, Teddy Nyambe <software....@gmail.com>wrote: > Ok let me check will revert at least you have given me a head start! > On 24 Feb 2014 16:27, "Anthony" <abasta...@gmail.com> wrote: > >> Well, it's just a string, so that's not the file. You have to figure out >> how the JS library is sending the file to the server. >> >> On Monday, February 24, 2014 9:18:32 AM UTC-5, software.ted wrote: >>> >>> What am supposed to see in dir and type? So that I can debug >>> On 24 Feb 2014 16:16, "Anthony" <abas...@gmail.com> wrote: >>> >>>> You'll have the check the JS framework docs to see how/where it is >>>> posting the file (e.g., maybe via a separate Ajax request). >>>> >>>> On Monday, February 24, 2014 8:50:51 AM UTC-5, software.ted wrote: >>>>> >>>>> the output is: >>>>> >>>>> Dir: >>>>> ['__add__', '__class__', '__contains__', '__delattr__', '__doc__', >>>>> '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', >>>>> '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', >>>>> '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', >>>>> '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', >>>>> '__setattr__', '__sizeof__', '__str__', '__subclasshook__', >>>>> '_formatter_field_name_split', '_formatter_parser', 'capitalize', >>>>> 'center', >>>>> 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'format', >>>>> 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', >>>>> 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace', >>>>> 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', >>>>> 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', >>>>> 'upper', 'zfill'] >>>>> >>>>> type: <type 'str'> >>>>> >>>>> >>>>> On Mon, Feb 24, 2014 at 3:40 PM, Anthony <abas...@gmail.com> wrote: >>>>> >>>>>> The output of type(request.vars.photo) and dir(request.vars.photo). >>>>>> >>>>>> >>>>>> On Monday, February 24, 2014 8:33:44 AM UTC-5, software.ted wrote: >>>>>> >>>>>>> I am using dhtmlx (www.dhtmlx.com) framework. The component am >>>>>>> using is dhtmlxform. I don't understand what you mean by class and >>>>>>> attribute. >>>>>>> On 24 Feb 2014 14:45, "Anthony" <abas...@gmail.com> wrote: >>>>>>> >>>>>>>> Can you provide information about the form processing tool? What is >>>>>>>> the class and attributes of request.vars.photo? >>>>>>>> >>>>>>>> Anthony >>>>>>>> >>>>>>>> On Monday, February 24, 2014 7:36:17 AM UTC-5, software.ted wrote: >>>>>>>>> >>>>>>>>> Am using form processing tool. Which has a send method...what it >>>>>>>>> actually does is make post/get to a url in the >>>>>>>>> form.send("{{=URL('c','a')}}") >>>>>>>>> >>>>>>>>> So what happens in the controller is that I can access the form >>>>>>>>> variables as follows: >>>>>>>>> >>>>>>>>> def a(): >>>>>>>>> file_name = request.vars.file_name >>>>>>>>> >>>>>>>>> The framework has code examples of how to access the uploaded file >>>>>>>>> in php and java >>>>>>>>> >>>>>>>>> Any ideas? >>>>>>>>> On 24 Feb 2014 14:27, "Anthony" <abas...@gmail.com> wrote: >>>>>>>>> >>>>>>>>>> Ajax doesn't allow file uploads in forms. Are you using an Ajax >>>>>>>>>> file upload widget on the client side? >>>>>>>>>> >>>>>>>>>> Anthony >>>>>>>>>> >>>>>>>>>> On Monday, February 24, 2014 2:35:02 AM UTC-5, software.ted wrote: >>>>>>>>>>> >>>>>>>>>>> I am extremely stuck on how to manage uploaded file, I have been >>>>>>>>>>> working with web2py now for over a year and I like its flexibility, >>>>>>>>>>> I have >>>>>>>>>>> been working on an application that is ajax based using my own >>>>>>>>>>> file. Now i >>>>>>>>>>> have the following scenario i need help with: >>>>>>>>>>> >>>>>>>>>>> DB >>>>>>>>>>> ======= >>>>>>>>>>> >>>>>>>>>>> db.create_table("person", Field("first_name"), Field("photo", >>>>>>>>>>> "upload"), ...) >>>>>>>>>>> >>>>>>>>>>> Controller: >>>>>>>>>>> >>>>>>>>>>> def manage_person(): >>>>>>>>>>> try: >>>>>>>>>>> value = db.person.update_or_insert(id == request.vars.id, >>>>>>>>>>> first_name=request.vars.first_name, photo=request.vars.photo, >>>>>>>>>>> ...) >>>>>>>>>>> except ...: >>>>>>>>>>> >>>>>>>>>>> return value >>>>>>>>>>> >>>>>>>>>>> Now my question is how do i move the upaded image to say the >>>>>>>>>>> upload folder, i was thinking web2py will put the physical image in >>>>>>>>>>> upload >>>>>>>>>>> folder according to documentation but unfortunately folder is >>>>>>>>>>> empty. The DB >>>>>>>>>>> hower gets updated with a the following: C:\fakepath\xxxx.jpg. >>>>>>>>>>> >>>>>>>>>>> Any ideas? >>>>>>>>>>> >>>>>>>>>>> Kind regards, >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> -- >>>>>>>>>>> ............................................................ >>>>>>>>>>> ........................... >>>>>>>>>>> Teddy Lubasi Nyambe >>>>>>>>>>> Opensource Zambia >>>>>>>>>>> Lusaka, ZAMBIA >>>>>>>>>>> >>>>>>>>>>> Cell: +260 97 7760473 >>>>>>>>>>> website: http://www.opensource.org.zm >>>>>>>>>>> >>>>>>>>>>> ~/ >>>>>>>>>>> Human Knowledge belongs to the world! - AntiTrust >>>>>>>>>>> >>>>>>>>>>> Man is a tool-using animal. Without tools he is nothing, with >>>>>>>>>>> tools he is all - Thomas Carlyle 1795-1881 >>>>>>>>>>> >>>>>>>>>>> /~ >>>>>>>>>>> >>>>>>>>>> -- >>>>>>>>>> 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+un...@googlegroups.com. >>>>>>>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>>>>>>> >>>>>>>>> -- >>>>>>>> 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+un...@googlegroups.com. >>>>>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>>>>> >>>>>>> -- >>>>>> 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+un...@googlegroups.com. >>>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> ............................................................ >>>>> ........................... >>>>> Teddy Lubasi Nyambe >>>>> Opensource Zambia >>>>> Lusaka, ZAMBIA >>>>> >>>>> Cell: +260 97 7760473 >>>>> website: http://www.opensource.org.zm >>>>> >>>>> ~/ >>>>> Human Knowledge belongs to the world! - AntiTrust >>>>> >>>>> Man is a tool-using animal. Without tools he is nothing, with tools he >>>>> is all - Thomas Carlyle 1795-1881 >>>>> >>>>> /~ >>>>> >>>> -- >>>> 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+un...@googlegroups.com. >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>> -- >> 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/groups/opt_out. >> > -- ....................................................................................... Teddy Lubasi Nyambe Opensource Zambia Lusaka, ZAMBIA Cell: +260 97 7760473 website: http://www.opensource.org.zm ~/ Human Knowledge belongs to the world! - AntiTrust Man is a tool-using animal. Without tools he is nothing, with tools he is all - Thomas Carlyle 1795-1881 /~ -- 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/groups/opt_out.