Forum OpenACS Development: Re: FS pkg: Upload multiple files

Collapse
Posted by Antonio Pisano on
Hello Iuri,

to better understand: can you please post the exact content of the upload_file variable before and after your "multiple" modification?

Also, I would be interested in the exact ad_page_contract of your page (the page variable definition) before and after.

One thing that pops into my mind at the moment could have something to do with the :array flag. Maybe could help.

https://openacs.org/api-doc/proc-view?proc=ad_page_contract&source_p=1

All the best

Collapse
Posted by Iuri Sampaio on
Pisano,

I believe the problem is that I have no clue how to handle variables with the structure "var.var" such as upload_file.tmpfile.

The chunk of code is very similar, if not the same, of file-add.tcl > ad_form > new_data's block.

To get started, I tried to ns_log Notice "$upload_file - $upload_file.tmpfile" within error.log but I had no success except for:


set myform [ns_getform]
if {[string equal "" $myform]} {
ns_log Notice "No Form was submited"
} else {
ns_log Notice "FORM"
ns_set print $myform
for {set i 0} {$i < [ns_set size $myform]} {incr i} {
set varname [ns_set key $myform $i]
set varvalue [ns_set value $myform $i]
if {[string match {cat_*} $varname]} {
#set varname [lindex [split $varname "_"] 1]
#lappend lchars "$varname $varvalue"
}
}
}

TCL's file croate-annonce.tcl: http://pastebin.com/UB9yDxnR
Also error.log is here: http://pastebin.com/GjKEtpqE

Best wishes,

Bellow, it is the error that returns if I remove "multiple" from ad_page_contract headers.

upload_file:multiple,trim,optional
upload_file.tmpfile:mutiple,tmpfile,optional


upload_file:trim,optional
upload_file.tmpfile:tmpfile,optional

[23/Mar/2017:08:36:11][1711.7f2caa548700][-conn:1contact:0-] Warning: User experienced 'You've supplied two values for 'upload_file'' when submitting a form related to path_info:
called from template::adp_parse /var/www/1contact/packages/1c-annonces/www/create-annonce {}
called from adp_parse_ad_conn_file
called from rp_serve_concrete_file /var/www/1contact/packages/1c-annonces/www/create-annonce.adp
called from rp_serve_abstract_file 0 0 .* /var/www/1contact/packages/1c-annonces/www/create-annonce
called from rp_handler
POST http://1c.1contact.ch:8000/annonces/create-annonce? referred by 'http://1c.1contact.ch:8000/annonces/create-annonce'; peer 192.168.0.4 user_id 698
post-data:

[23/Mar/2017:08:36:11][1711.7f2caa548700][-conn:1contact:0-] Warning: User experienced 'You've supplied two values for 'upload_file.tmpfile'' when submitting a form related to path_info:
called from template::adp_parse /var/www/1contact/packages/1c-annonces/www/create-annonce {}
called from adp_parse_ad_conn_file
called from rp_serve_concrete_file /var/www/1contact/packages/1c-annonces/www/create-annonce.adp
called from rp_serve_abstract_file 0 0 .* /var/www/1contact/packages/1c-annonces/www/create-annonce
called from rp_handler
POST http://1c.1contact.ch:8000/annonces/create-annonce? referred by 'http://1c.1contact.ch:8000/annonces/create-annonce'; peer 192.168.0.4 user_id 698
post-data:

[23/Mar/2017:08:36:11][1711.7f2caa548700][-conn:1contact:0-] Warning: User experienced 'You've supplied two values for 'upload_file'' when submitting a form related to path_info:
called from template::adp_parse /var/www/1contact/packages/1c-annonces/www/create-annonce {}
called from adp_parse_ad_conn_file
called from rp_serve_concrete_file /var/www/1contact/packages/1c-annonces/www/create-annonce.adp
called from rp_serve_abstract_file 0 0 .* /var/www/1contact/packages/1c-annonces/www/create-annonce
called from rp_handler
POST http://1c.1contact.ch:8000/annonces/create-annonce? referred by 'http://1c.1contact.ch:8000/annonces/create-annonce'; peer 192.168.0.4 user_id 698
post-data:

[23/Mar/2017:08:36:11][1711.7f2caa548700][-conn:1contact:0-] Warning: User experienced 'You've supplied two values for 'upload_file.tmpfile'' when submitting a form related to path_info:
called from template::adp_parse /var/www/1contact/packages/1c-annonces/www/create-annonce {}
called from adp_parse_ad_conn_file
called from rp_serve_concrete_file /var/www/1contact/packages/1c-annonces/www/create-annonce.adp
called from rp_serve_abstract_file 0 0 .* /var/www/1contact/packages/1c-annonces/www/create-annonce
called from rp_handler
POST http://1c.1contact.ch:8000/annonces/create-annonce? referred by 'http://1c.1contact.ch:8000/annonces/create-annonce'; peer 192.168.0.4 user_id 698
post-data:

[23/Mar/2017:08:36:11][1711.7f2caa548700][-conn:1contact:0-] Notice: