Forum .LRN Q&A: File upload

Collapse
Posted by M'Hamed CHERIF on
When I try to upload a file in DotLRN I get the message "you specified a path to a file that is not allowed on the system. I also get the same message when creating a news item, though I am not attempting to read from a file. Can someone help out please !
Collapse
2: Re: File upload (response to 1)
Posted by Nima Mazloumi on
Seems like you are using Windows? You need to comment out the following line:

In: acs-tcl/tcl/tcl-documentation-procs.tcl
Filter: ad_page_contract_filter tmpfile

#ad_complain "You specified a path to a file that is not allowed on the system."
# return 0
return 1

Collapse
3: Re: File upload (response to 1)
Posted by M'Hamed CHERIF on
Dear Nima,

Many thanks for your advice. I am indeed using Windows. Meanwhile, I have partly solved the problem by doing the following in /file storage/add-file

1- deleted the command "upload_file.tmpfile:tmpfile,optional"
2- added the command "set where_the_data_is upload_file.tmpfile"
3- replaced all references to "upload_file.tmpfile" by "where_the_data_is"

Of course, these changes should be made in all files where a file upload is
required (e.g. news, lorsm, file manager). I am not sure this is the most elegant way of solving the problem. I will of course try our suggestion.

Regards,

M'Hamed

Collapse
4: Re: File upload (response to 1)
Posted by Dave Bauer on
Wait!

This means that the temporary path configured for OpenACS is not accessible by the AOLserver user. There is no bug in the actual pages.

Collapse
5: Re: File upload (response to 1)
Posted by M'Hamed CHERIF on
The temporary file created by WINDOWS is:
C:/WINDOWS/TEMP/AOL21.tmp

The set command is of course:
SET where_the_data_is [ns_queryget upload_file.tmpfile]

Note that the commenting out in the documentation-proc was not helpful.

Collapse
6: Re: File upload (response to 1)
Posted by Jamie Rasmussen on
I don't know if this is still the problem, but in the past file uploads were broken on Windows because ad_page_contract_filter_proc_tmpfile in packages\acs-tcl\tcl\tcl-documentation-procs.tcl and check_for_form_variable_naughtiness in packages\acs-tcl\tcl\utilities-procs.tcl fall back on "/var/tmp" and "/tmp". You could change these procs to include something like this:
set tmpdir_list [ad_parameter_all_values_as_list TmpDir]
if { [empty_string_p $tmpdir_list] } {
	global tcl_platform
	if {$tcl_platform(platform) == "windows"} {
		set tmpdir_list [list [file dirname [ns_tmpnam]]]
	} else {
		set tmpdir_list [list "/var/tmp" "/tmp"]
	}
}
ad_page_contract_filter_proc_tmpfile
check_for_form_variable_naughtiness