Forums

Get URL of Uloaded File

momentis 06 Mar, 2014
I know I have done this in the past, but I cannot seem to get it to work.

I have a CF form which allows upload of a file to the server. On the form, the file upload field is named 'share_file'. I have the UPLOAD FILE action in the ON SUBMIT event and it is working fine. I need to capture the full URL of the uploaded file, and store that URL in a field on the DB.

I have a field in the DB named 'share_file_link', and it is on the form as a hidden field.

I am using the following custom code, running after the UPLOAD FILE action:

<?php
$filelink = $form->data['share_file_url'];
$form->data['share_file_link'] = $filelink;
?>


This is not working, even though (I believe) I followed my previous use of this.

Thanks!!
Rick
Max_admin 09 Mar, 2014
Answer
Hi Rick,

This code is wrong:
$form->data['share_file_url']

You need to place a "debugger" action after the upload file action to find the correct path to the file's url under the data array, then you can use instead of the code above!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
momentis 09 Mar, 2014
Thanks Max! I will give that a try.
momentis 09 Mar, 2014
That did it! I had to use the following to pull the URL:

$filelink = $form->data['_PLUGINS_']['upload_files']['share_file']['link'];


Thanks for the help, Max!
Rick
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger