item type file with send API

Hi:

Trying to use dhtmlxForm Beta 3.0 with a “file” item.

When trying to “Save data using server side script” the file item does not show up in the $_POST or $_REQUEST data?

SAMPLE CODE:


Test html file


File
<link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxform_dhx_skyblue.css">
<script src="../../codebase/dhtmlxcommon.js"></script>
<script src="../../codebase/dhtmlxform.js"></script>

<script>
	var myForm, formData;
	function doOnLoad() {
		formData = [
			{type: "settings", position: "label-left"},
			{type: "input", name: "testname", label: "Name"},
			{type: "file", name: "testfile", label: "Upload screenshot"},
			{type: "button", value: "Send", name: "send"}
		];
		myForm = new dhtmlXForm("myForm", formData);
		
		
		myForm.attachEvent("onButtonClick", function(id){
			if (id == "send")
				myForm.send('mirror.php', function(loader, response){
					alert(response);
				});
		});
		
		
	}
</script>

mirror.php


<?php print_r($_REQUEST); ?>

OUTPUT from mirror.php


Array
(
[testname] => dddd
)

I’m having the same issue, any solution or workaround for this?

Regards!

It’s like the content-type has to be changed to ‘multipart/form-data’, because by default ‘application/x-www-form-urlencoded’ is used.

Any way to setup the content-type of the form using the DHTMLX API?

Thanks guys!

Unfortunately current version of dhtmlxForm doesn’t’ have such functionality