change upload directory based on URL

meeotch - June 3, 2008 - 20:35
Project:Webform
Version:5.x-2.0
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hoping someone can point me in the right direction on this. (I'll post my eventual solution in return.) I've got an anonymous submission form for a contest entry, and after the user submits it, I want to redirect to a form that will allow him to upload a file to a newly created private directory, based on information from the first form. So:

1) user submits form #1, including project name and other info
2) directory is created for his project
3) he is redirected to an upload form, which uploads to his directory

I know this is probably some combination of the "additional processing" and "redirect URL" fields, but I'm a little weak on the details. Also, the redirect URL needs to be re-usable, in the event that he wants to come back and upload later. (So the directory identifier should appear in the URL.)

#1

quicksketch - June 4, 2008 - 07:54

Hmmm... generally, I think what you're trying to accomplish is outside the scope of Webform. If this is being used a central feature of your site, I'd discourage you from using Webform. It sounds like this could be a better CCK implementation, or an entirely custom solution.

#2

meeotch - June 4, 2008 - 08:34

Anyway, I did get the first part figured out... I discovered elsewhere the bit where webform passes the sid to the confirmation page via "?sid=xxx" So in my confirmation page, I've got code like this:

<?php
include_once(drupal_get_path('module', 'webform') .'/webform_submissions.inc');
$sid = $_GET['sid'];
$submission = webform_get_submission(320, $sid);
$project = $submission['data'][3]['value'][0];
?>

Which at least allows me to grab information from the project submission. I'm guessing it's possible to switch out the savelocation of the file component somehow. I know I can get the webform and paste it into my confirmation page like this:

<?php
$node
= node_load(320);
print
node_view($node);
?>

...but I'm unclear as to how exactly to drill down to the file component and its savelocation. I guess my forms API knowledge is a little weak in general. Another possibility that occurred to me would be to allow the upload form write the file to a generic location, then attempt to move it with "additional processing"... but that seems less clean somehow.

#3

quicksketch - August 8, 2008 - 04:42
Status:active» closed

Closing after lack of activity.

 
 

Drupal is a registered trademark of Dries Buytaert.