Problem of posting file name using file uploader

gnimkat 30 Mar, 2012
Chronoform is really a good component. Many thanks for developing this component. I got a little question about it.

I got a problem of empty filename when posting a file via Chronoform v4.I am creating a form with file uploading function. I would like to save the uploaded file with the original file name on the server and also in the dB. Therefore, i installed the file uploader GH. I created a file uploader named "input_file_0" and also created a column in DB with same name. I put the {input_file_0} into file name field of configuration of ile uploader GH. After finished all setup, I tried uploading a pdf file"abc.pdf". The file is uploaded successfully onto the server, however it doesn't have a file name" I found a file "PDF" on the server. When search in the db, there was an empty entry in the "input_file_0" field. It seems that the file name was fail to be posted.

Here is the capture of debugger

Data Array:
Array
(
[chronoform] => file
[event] => submit
[Itemid] => 148
[option] => com_chronoforms
[view] => form
[input_file_0] => pdf
[input_submit_2] => Submit
[c6aa68cec035cddae65d274f3247ea2b] => 1
[chronoform_data] => Array
(
[cf_uid] => 6710df25d8d8c47482d2bc31355f6959
[cf_created] => 2012-03-30 11:33:26
[cf_ipaddress] => 127.0.0.1
[cf_user_id] => 0
[chronoform] => file
[event] => submit
[Itemid] => 148
[option] => com_chronoforms
[view] => form
[input_file_0] =>
[input_submit_2] => Submit
[c6aa68cec035cddae65d274f3247ea2b] => 1
[cf_id] => 69
)

[chronoform_data_cf_id] => 69
[input_file_0_size] => 12
[color=#FF0000][input_file_0_url] => http://localhost/test17/components/com_chronoforms/uploads/file/pdf[/color]
[input_file_0_path] => C:\xampp\htdocs\test17\components\com_chronoforms\uploads\file\pdf
[_PLUGINS_] => Array
(
[upload_files] => Array
(
[input_file_0] => Array
(
[name] => pdf
[path] => C:\xampp\htdocs\test17\components\com_chronoforms\uploads\file\pdf
[size] => 11899
[link] => [url=http://localhost/test17/components/com_chronoforms/uploads/file/pdf]http://localhost/test17/components/com_chronoforms/uploads/file/pdf[/url]
)

)

)

Could you please help? many thanks.
GreyHead 31 Mar, 2012
Hi gnimkat ,

My apologies, I dodnt' think of that case, and I didn't document the action well enough :-(

The problem is that file inputs don't return any value in the submitted $_POST data so when the action tried to replace it it sets that empty value.

If you put {file_name} in the file name box it will use the name of the uploaded file
or, if you leave it empty it will prefix the name with a date-time string (useful if files may have the same name).

I've added a fix to my code for the next release so that if there is no value set it will revert back to the uploaded file name.

Bob
gnimkat 02 Apr, 2012
Dear Bob,

Thanks for your prompt response and help. I can upload file with it's original names now.😀
About the problem, file inputs don't return any value in the submitted $_POST data, is it an abnormal case which may caused by the html code i wrote, the version of browser, or any other reasons? Or it's a bug of the component?

Regards,
gnimkat
GreyHead 02 Apr, 2012
Hi gnimkat,

It's normal, file uploads are returned in the $_FILES array.

Bob
gnimkat 03 Apr, 2012
See, thanks for your help again.
This topic is locked and no more replies can be posted.