cforms II User Forum

Registration is currently disabled.


Login form protected by Login LockDown.

Lost password?
Advanced Search

— Forum Scope —


— Match —


— Forum Options —


Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS Related Topics
direct link to uploaded files
December 14, 2011
7:45 am

Thanks for this amazing plugin! 


I'm wondering if anyone has a read-made script that I can paste into the right place(s) which will show a direct link to the files that were uploaded with a form following successful submission. I want to give users a certainty that their file has been uploaded and showing a direct link would be the best way to do that.


We're running an art competition and in a previous edition we ended up with a lot of duplicate submissions, which I think is attributable to the fact that users were not entirely sure if we received their files. We do provide a confirmation email and are now redirecting them to a success page. But still, letting them click on links and see their files in our server's folder will really help.


Thanks for your help.

December 17, 2011
10:12 pm



I found /cforms-forum/troubleshooting/possible-to-pass-user-data-into-a-custom-confirmation-page/;


return $oldvalue;


All the success page returns is:

Files uploaded successfully:

Of course I'd rather that it had picked up the content of the variable definition.


What I don't understand is the syntax abbreviation:



Can anyone help me specifically with this?



December 17, 2011
10:26 pm

I see that —>    return …httphere…'.$var1.'&var2='.$var2  <—   is the full text in the original reply to the other post, but it was cut off by an auto-shortening of links to be —>  return'.$var1.'&var2='.$var2;  <— in the forum.


I still would like to know how to use the single quotes properly in this context. I''m not getting it.


return '…httphere…'.$pdffilename1'';


creates a syntax error maybe because of the double use of the single quote at the end?


Thank you.

December 18, 2011
2:54 pm

OK. I have it, except for the NoID. I can't get that, but I'm very close. My template page is successfully getting the data that is passed through the URL redirect and I'm able to display the links with the following:


Files uploaded successfully:<br/>
<blockquote><a href="<?php echo htmlspecialchars($_GET['$varpdf1']); ?>">PDF File 1</a><br/>

my-functions.php now has the following:

function my_cforms_logic($cformsdata,$oldvalue,$setting) {
if ( $setting == "redirection" ){

$pdffilename1 = $cformsdata[$e['id']][$cformsdata['data']['$$$1']] . '-' . $cformsdata['data'][$cformsdata['data']['$$$1']];//this is obviously where the trouble lies…

if ( $cformsdata['id']==2 ) //this is form 2
return '$varpdf1=&#039; . $pdffilename1 . '&$varpdf2=' . $pdffilename2 . '&$varpdf3=' . $pdffilename3 . '&$varpdf4=' . $pdffilename4 . '&$varpdf5=' . $pdffilename5 . '';

return $oldvalue;

December 19, 2011
10:35 pm

If anyone has a similar requirement, I finally got it working: It's probably very hacky (I'm not a programmer), but it works. If anyone has a smoother way to do this, please do let me know.



function my_cforms_logic($cformsdata,$oldvalue,$setting) {

if ( $setting == "redirection" ){

$array = get_cforms_entries('Submission',false,false,'id',1,'desc');
foreach( $array as $e ){

if ( $cformsdata['id']==2 )

return '$varpdf1=&#039; . $e['id'] . '-' . $e['data']['First PDF File [*2]'] . '&$varpdf2=' . $e['id'] . '-' . $e['data']['Second PDF File [*2]'] . '&$varpdf3=' . $e['id'] . '-' . $e['data']['Third PDF File [*2]'] . '&$varpdf4=' . $e['id'] . '-' . $e['data']['Fourth PDF File [*2]'] . '&$varpdf5=' . $e['id'] . '-' . $e['data']['Project Narrative File [*2]'] . '';

return $oldvalue;

Your special page template in wordpress (assign it to the 'success' page)

<!doctype html>
* Template Name: Success Upload Page
// You can override via functions.php conditionals or define:
// $columns = 'four';

blah blah blah … your text here.<br/><br/>
&nbsp;&nbsp;&nbsp;<a href="<?php echo htmlspecialchars($_GET['$varpdf1']); ?>" target="blank">PDF File 1</a><br/>
&nbsp;&nbsp;&nbsp;<a href="<?php echo htmlspecialchars($_GET['$varpdf2']); ?>" target="blank">PDF File 2</a><br/>
&nbsp;&nbsp;&nbsp;<a href="<?php echo htmlspecialchars($_GET['$varpdf3']); ?>" target="blank">PDF File 3</a><br/>
&nbsp;&nbsp;&nbsp;<a href="<?php echo htmlspecialchars($_GET['$varpdf4']); ?>" target="blank">PDF File 4</a><br/>
&nbsp;&nbsp;&nbsp;<a href="<?php echo htmlspecialchars($_GET['$varpdf5']); ?>" target="blank">Project Narrative DOC File</a>
get_template_part( 'loop', 'page' );

December 21, 2011
10:28 am

Ok I need something like this!!! Can someone please help explain how I edit this… 


I have a form with a captcha, upload field, and submit button…. that all works fine. I just need it to output the "Direct Link" address to the file in the success page. Can some one please help me with this!!!


Thank You,



p.s. Iam using the WordPress CformsII plugin if that makes a diffrence

June 27, 2012
5:03 pm

I'm trying to do the same thing, only I want the direct link to show up in the email message I receive.  I have the same sort of submissio-type form, the user can select who to send it to, upload their attachments, provide a description and click send.  The problem I am finding is that the images or files show up as attachments, and do not correspond with their descriptions – it becomes an issue when there is more than one attachment – especially if the attachments are similar!  If I can find a way to embed the direct link to the file next to the descriptions, then this would really help eliminate confusion!  The way you have done it in the success page looks great – do you know of any way to translate that into the html email?  Any help would be much appreciated!

July 1, 2012
6:40 pm
Munich, Germany
Forum Posts: 6400
Member Since:
March 6, 2005

you can do that via some custom coding my-functions.php (modify the admin/confrm message etc. on the fly to add the attachment link)

it is a bit tricky, but possible.

March 9, 2013
4:58 pm

Oliver and others,

Has anyone figured out the custom coding Oliver mentions in the prior post in order to get a link to the attached document to populate in the email notification? I'm not a programmer, but this function would be highly useful.

Forum Timezone: Europe/Berlin

Most Users Ever Online: 959

Currently Online:
25 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

tracedef: 43

mores: 21

Gyrus: 20

frozenwaste: 18

asuffredini: 15

photoworks: 14

Member Stats:

Guest Posters: 3758

Members: 1463

Moderators: 3

Admins: 2

Forum Stats:

Groups: 1

Forums: 4

Topics: 5356

Posts: 18736

Newest Members: juredujmovic, dreamkeeper, rajattyagi, wrokaa, lukass

Moderators: Paul (421), cnymike (8), sonika (95)

Administrators: Oliver (6400), Nicky (3)