Preview type: "file" in form using a container

How can I preview a type: “file” in form using a container? like this: http://jsfiddle.net/LvsYc/

here’s a part of my code:

{type: “file”, name:“image”},
{type: “container”, name:“myimg”}

Hi

add once after form.js is loaded

dhtmlXForm.prototype.items.file.getInput = dhtmlXForm.prototype.items.input.getInput;

then get input

var input = myForm.getInput("some_file"); readURL(input); // from jsfiddle one

Another question, what’s would be the serverside code to get the type:file once the add button is clicked? I use post method.

I know to implement the serverside code for type:upload but for file i don’t know how to.

Please disregard this question:

"Another question, what’s would be the serverside code to get the type:file once the add button is clicked? I use post method.

I know to implement the serverside code for type:upload but for file i don’t know how to."

I’ve decided to use upload. However, I’m having problems with the server side code especially in saving the uploaded files to the database.

view:

                        var str = [
			{type:"settings", offsetLeft: 20},
			{type: "label", label: "Add Product"},
			{type: "label"},
                        {type:"input" ,name:"description" ,label:"Product Name", labelWidth:150 ,inputWidth:200},
                        {type:"template", label:"Product Image", labelWidth:150},
			{type: "upload", 
				name: "image", 
				url: "product_list/upload", 
				swfPath: "<?php base_url(); ?>codebase/ext/uploader.swf", 
				swfUrl: "product_list/upload",
				autoStart: true,
			},
			{type: "label"},
			{type: "template", list: [
					{type:"button" ,name:"addcatalogue" ,value:"Add Product"},
					{type: "newcolumn"},
					{type:"button" ,name:"cancel" ,value:"Cancel"}
			]
        	}
		];

I’m done with moving the uploaded files to a directory.

What I wanted is after clicking the “addcatalogue” button, On the server side, is to get the filename of the uploaded file. Let’s limit the file to only one. How will I be able to do it?

Here’s a part of my server side code:

                $data = array(
			'description' => $this->input->post('description'),
			'image' => $this->input->post('image')
		);
	
		$this->db->insert('catalogue', $data);

I’ve tried $this->input->post(‘image’) but it is not working.

Hi

please check /dhtmlxForm/samples/07_uploader/php/dhtmlxform_item_upload.php
this is server-side demo for form’s uploader

Please give me the full link.

Nothing is shown for this: http://dhtmlx.com/docs/products/dhtmlxForm/samples/07_uploader/php/dhtmlxform_item_upload.php

you need to download dhtmlxForm_v402.zip or dhtmlxSuite_v402.zip, file inside

Thanks! I’ve solved the problem.