Hello,

I have an upload field in my form. It works fine when I run it on the same 
machine as the web2py service. The issue comes when I run the service on 
the server and the UI on a different machine. The issue is the fact that 
existence of the file path I enter is checked on the server as opposed to 
the machine from where I try to upload the file. How do you fix it? This is 
the definition of the form I have:


list_dictionary_names = os.listdir(os.getcwd() + 
*'/applications/mcarriage_console/uploads/dictionaries'*)
    list_dictionary_types = list(set((i[:i.find(*'_'*)] if i[:i.find(*'_'*)]
 == *'ITCR'* else i[:i.find(*'_D'*)].replace(*'_'*, *' '*))  for i in
 list_dictionary_names if i[0].isupper()))
    obj_admin = AdminClass(auth, db, session)

    
    alert_message = *'Process of uploading may take a few minutes. The file 
content is first inserted into MARS database. '*
    alert_message += *'Then content of the previously active file is 
checked for any updates. '*
    alert_message += *'If no changes were made the content of the 
previously file is removed '*
    alert_message +=  *'and the previously active data dictionary is set 
inactive.'*
    session.message = alert_message
    #obj_message = MessageDisplay(session.message)
    button_list = [INPUT(_type=*'submit'*, _value=*'Submit'*)]

    
    form = SQLFORM.factory(
                           Field(*'file_type'*,
                                 label = *'Dictionary Type'*,
                                 requires=IS_IN_SET([ i[*'DICTIONARY_TYPE'*]
 for i in db(db.DATA_DICTIONARIES.ACTIVE_ID == *'A'*).select(
db.DATA_DICTIONARIES.DICTIONARY_TYPE)] if len(db(
db.DATA_DICTIONARIES.ACTIVE_ID == *'A'*).select(
db.DATA_DICTIONARIES.DICTIONARY_TYPE)) > 4 else list_dictionary_types  )),
                           Field(*'file_version'*,
                                 label = *'Dictionary Version'*,
                                 requires=IS_NOT_EMPTY()),
                           Field(*'file_directory'*,
                                 label = *'File Path'*,
                                 _type = *'string'*,
                                 requires=IS_NOT_EMPTY()
                                 #uploadfield=False,
                                 #uploadfolder
=os.path.join(request.folder,'uploads/')
                                 ),
                           #Field('file', 'upload', requires = IS_LENGTH(
minsize=0, maxsize=1048576, error_message='File is too huge.')),
                          buttons = button_list
                          )

-- 
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/d/optout.

Reply via email to