Create Folder
Is there any way to have Digital File Pro create an upload folder on the server based on server variables or Cookies to upload files in?
Is there any way to have Digital File Pro create an upload folder on the server based on server variables or Cookies to upload files in?
Yes, click the lightning bolt next to Upload Folder and select the desired session variable from the Dynamic Data bindings.
Thanks.
I am trying this and it is not working. What I want to do is to upload to folder
Members/PrimarySchools/<?php echo $row_OrgInfo['OrgID']; ?>/
where <?php echo $row_OrgInfo['OrgID']; ?> is the dynamic text from the database.
Is this the right way to build a path to an upload folder and have File Upload create the folder if it does not exist?
Dexter
Hey Dexter,
Where is that code located? I noticed you have a PHP open and close tag surrounding an echo command... but my guess is that you are already within a PHP block of code for the DFP server behaviors. If that is the case, you don't want to nest a PHP block within a PHP block.
Best regards,
Brian
make sure the Upload server behavior code comes after the recordset. If the recordset is not created before the file is uploaded, the $row_OrgInfo['OrgID'] wont have a value yet.
Thanks, but exactly what should be in the DFP Upload Folder text box?
Members/<?php echo $row_OrgInfo['OrgID']; ?>/ ?
Members/?php echo $row_OrgInfo['OrgID']; ?/ ?
or what other text? When I use the lightning bolt, I get
<?php echo $row_OrgInfo['OrgID']; ?>
But this does not work either. If the value of ORGID is 10, I want it to create a folder named 10 in the Members Folder, and upload the file logo there.
If it is inside a php block, you will only need to set the value as
$row_OrgInfo['OrgID']
not with the PHP echo command...
But you will want to concatenate it with the other stuff in the variable so it is clear to PHP how to process...
for example, if you folder path is "/images/", when you set the variable, your code should look like this
'UploadFolder' => "Members/PrimarySchools/".$row_OrgInfo['OrgID']."",
Remember to set the permissions correctly in the parent folder, as well. You have to enable write permissions of the Primary Schools folder in order to create folders within.
Cheers,
Brian
This is the code as it stands now.
Notice the code for uploading Logo is exactly as you described.
However, the folder is still not being created. and nothing is uploaded.
Permissions are set for both the Members and the PrimarySchools Folder to allow Everything for Everybody. (777)
What is wrong?
<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "Members/PrimarySchools/".$row_OrgInfo['OrgID']."",
'FileName' => "Logo",
'DefaultFileName' => "",
'ResizeType' => "0",
'ResizeWidth' => "120",
'ResizeHeight' => "120",
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult1_1 End
// WA_UploadResult1_2 Start
$WA_UploadResult1_Params["WA_UploadResult1_2"] = array(
'UploadFolder' => "Members/PrimarySchools/",
'FileName' => "Logo_thumb",
'DefaultFileName' => "",
'ResizeType' => "4",
'ResizeWidth' => "120",
'ResizeHeight' => "120",
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult1_2 End
// WA_UploadResult1 Params End?>
<?php
// WA_UploadResult2 Params Start
$WA_UploadResult2_Params = array();
// WA_UploadResult2_1 Start
$WA_UploadResult2_Params["WA_UploadResult2_1"] = array(
'UploadFolder' => "Members/PrimarySchools/".$row_OrgInfo['OrgID'] ."/",
'FileName' => "MissionVision",
'DefaultFileName' => "",
'ResizeType' => "0",
'ResizeWidth' => "0",
'ResizeHeight' => "0",
'ResizeFillColor' => "" );
// WA_UploadResult2_1 End
// WA_UploadResult2 Params End?>
<?php
// WA_UploadResult3 Params Start
$WA_UploadResult3_Params = array();
// WA_UploadResult3_1 Start
$WA_UploadResult3_Params["WA_UploadResult3_1"] = array(
'UploadFolder' => "Members/PrimarySchools/".$row_OrgInfo['OrgID'] ."/",
'FileName' => "SongPrayer",
'DefaultFileName' => "",
'ResizeType' => "0",
'ResizeWidth' => "0",
'ResizeHeight' => "0",
'ResizeFillColor' => "" );
// WA_UploadResult3_1 End
// WA_UploadResult3 Params End?>
<?php
// WA_UploadResult4 Params Start
$WA_UploadResult4_Params = array();
// WA_UploadResult4_1 Start
$WA_UploadResult4_Params["WA_UploadResult4_1"] = array(
'UploadFolder' => "Members/PrimarySchools/",
'FileName' => "RulesRegs",
'DefaultFileName' => "",
'ResizeType' => "0",
'ResizeWidth' => "0",
'ResizeHeight' => "0",
'ResizeFillColor' => "" );
// WA_UploadResult4_1 End
// WA_UploadResult4 Params End?>
Lets take a step back for a moment.
Can you get the upload to work without trying to dynamically set the upload folder name?
We need to first determine if it is a problem with uploading, or the dynamically named folder.
If you can get the upload to work without the dynamically named folder, then try again using the recordset. If your still having problems, add the php page to a zip file and attach it to your reply so I can see the entire code on the page including the recordset.
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.