Are there any examples available showing how to use a form with a type=file field? I can’t find how to actually use a form to transfer a file back serverside. getItemValue only works on input items so I can’t even get the value of the file that was selected.
Thanks!
There is no way to send file data by ajax, so dhtmlxForm doesn’t provide such kind of control.
Andrei
November 15, 2010, 2:57pm
#3
It should work fine if you put form into form tag with enctype=“multipart/form-data” and submit button, like:
<form enctype="multipart/form-data" method="POST" action="server.php">
<div id="myFormObj"></div>
<input type="submit" value="Upload">
</form>
and
var formData = [{type: "file", name: "myFile", label: "Select file"}];
myForm = new dhtmlXForm("myFormObj", formData);
server.php > print_r($_FILES);
will return the following output:
Array
(
[myFile] => Array
(
[name] => 1.gif
[type] => image/gif
[tmp_name] => /tmp/phptKoJxZ
[error] => 0
[size] => 507965
)
)
After clicking ok button i need to read the content of the file and store the data in to the editor how should i do this one
Andrei
May 22, 2012, 3:48pm
#5
You need to use server side for this.
1st step will uploading file, and 2nd one - reading it content and put it into editor.