***Upload Example NaviServer*** [LostOne] Hi, welcome to to the fascinating world of NaviServer where you've got the whole world at your fingertips, documentation everywhere, OpenAcs and other cool software with a great development team but almost no beginner tutorials or any howto's.. I'm afraid you'll need to spent a lot of time searching the net and looking at examples of other software developed using aolserver/naviserver to "get it". Uploading is done in multiple ways in NaviServer, there's even a cool way to spool the upload too a different thread in the background that won't eat your RAM by using temporary files. But for now we'll imagine you're trying to upload 1 file. First thing's first create a file.. in this case index.adp ====== <% #If your server is only set for .adp replace this by #ns_adp_include main.adp ns_adp_include -tcl -nocache main.tcl set return [uploadfile] ns_puts $return ns_adp_include -cache 10 form.adp %> ====== To upload a file you need to set the form to '''enctype="multipart/form-data"''' otherwise you will never upload the file correctly, this will fustrate you and you'll lose HOURS. Had the same problem in websh for apache.. form.adp ======
====== main.tcl/main.adp Create a folder upload in your pagepath (mine is www yours could be anything in the settings) ====== #Verify upload info proc uploadfile {} { set output "" if {[ns_queryexists submit]} { foreach key {titlu autor fisier} { set $key [ns_queryget $key] } if {$titlu == ""} { append output "