close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Using DFP in a restricted environment

Thread began 8/26/2011 8:24 am by Joe Lowery | Last modified 8/31/2011 9:38 am by Jason Byrnes | 2238 views | 7 replies |

Joe Lowery

Using DFP in a restricted environment

I'm trying to set up some upload fields with DFP on a server where only one folder is open for server writing access. Any other files must be FTP'd in. If I remember correctly, DFP uploads the file to a temporary directory and then moves the file once the upload is complete. If that's right, what do you recommend I do to get this to work? Let me know if I must have another folder server-writable or if I can switch the temporary folder to the one folder I have available to me somehow.

Thanks - Joe

Sign in to reply to this post

Jason ByrnesWebAssist

in the php.ini file, there is a setting called "upload_tmp_dir"

this sets the temporary directory where uploaded files will be stored, digital file pro will then copy the uploaded file from this directory to the upload folder in your site.

if the "upload_tmp_dir" is not set, php will use the system temp directory.

Sign in to reply to this post

Joe Lowery

Thanks, Jason. Is this how all upload routines work? If not, why was this route taken? I'm just asking to explain it to the client.

Sign in to reply to this post

Jason ByrnesWebAssist

yes, this is the way file uploads work in PHP.

The form creates a $_FILES array for the file fields and a $_POST array for all of the other form elements.

when the server gets the $_FILES array, it creates the uploaded file in the upload_tmp_dir

A PHP script can access the file in the upload_tmp_dir and save it to another location.

Sign in to reply to this post

Joe Lowery

Perfect. Thanks, Jason.

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome Joe.

Sign in to reply to this post

Joe Lowery

The IT dept. at the university came back and said that the TMP directory was enabled for server writing. I now get a series of errors when I try to submit a photo via my update page:

Warning: mkdir() [function.mkdir]: Permission denied in /web/1/manoa.hawaii.edu/ctahr/tpss/webassist/file_manipulation/helperphp.php on line 30

Warning: mkdir() [function.mkdir]: No such file or directory in /web/1/manoa.hawaii.edu/ctahr/tpss/webassist/file_manipulation/helperphp.php on line 30

Warning: mkdir() [function.mkdir]: No such file or directory in /web/1/manoa.hawaii.edu/ctahr/tpss/webassist/file_manipulation/helperphp.php on line 30

Warning: mkdir() [function.mkdir]: No such file or directory in /web/1/manoa.hawaii.edu/ctahr/tpss/webassist/file_manipulation/helperphp.php on line 30

Warning: move_uploaded_file(/web/1/manoa.hawaii.edu/ctahr/tpss/admin/../tpss/wp-content/uploads/photos/75fac29fb74cdaa7eae952fde30d8a2e_tmp.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /web/1/manoa.hawaii.edu/ctahr/tpss/webassist/file_manipulation/helperphp.php on line 96

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/var/tmp/phpG7aiBi' to '/web/1/manoa.hawaii.edu/ctahr/tpss/admin/../tpss/wp-content/uploads/photos/75fac29fb74cdaa7eae952fde30d8a2e_tmp.jpg' in /web/1/manoa.hawaii.edu/ctahr/tpss/webassist/file_manipulation/helperphp.php on line 96

Warning: copy(/web/1/manoa.hawaii.edu/ctahr/tpss/admin/../tpss/wp-content/uploads/photos/75fac29fb74cdaa7eae952fde30d8a2e_tmp.jpg) [function.copy]: failed to open stream: No such file or directory in /web/1/manoa.hawaii.edu/ctahr/tpss/webassist/file_manipulation/helperphp.php on line 98



Here's the server code for my page:

<?php
$Paramid_WADAfaculty = "-1";
if (isset($_GET['id'])) {
$Paramid_WADAfaculty = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}
mysql_select_db($database_connTPSS, $connTPSS);
$query_WADAfaculty = sprintf("SELECT * FROM faculty WHERE id = %s", GetSQLValueString($Paramid_WADAfaculty, "int"));
$WADAfaculty = mysql_query($query_WADAfaculty, $connTPSS) or die(mysql_error());
$row_WADAfaculty = mysql_fetch_assoc($WADAfaculty);
$totalRows_WADAfaculty = mysql_num_rows($WADAfaculty);?>
<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "../tpss/wp-content/uploads/photos",
'FileName' => "[FileName]",
'DefaultFileName' => "",
'ResizeType' => "2",
'ResizeWidth' => "150",
'ResizeHeight' => "120",
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult1_1 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' => "../tpss/wp-content/uploads/photos",
'FileName' => "[FileName]",
'DefaultFileName' => "",
'ResizeType' => "0",
'ResizeWidth' => "0",
'ResizeHeight' => "0",
'ResizeFillColor' => "" );
// WA_UploadResult2_1 End
// WA_UploadResult2 Params End
?>
<?php?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["Update_x"])){
WA_DFP_UploadFiles("WA_UploadResult1", "photo", "0", "", "true", $WA_UploadResult1_Params);
}?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult2");
if(isset($_POST["Update_x"])){
WA_DFP_UploadFiles("WA_UploadResult2", "publicationLink", "0", "", "false", $WA_UploadResult2_Params);
}?>
<?php
// WA Application Builder Update
if (isset($_POST["Update_x"])) // Trigger
{
$WA_connection = $connTPSS;
$WA_table = "faculty";
// $WA_redirectURL = "faculty_Detail.php?id=".((isset($_POST["WADAUpdateRecordID"]))?$_POST["WADAUpdateRecordID"]:"") ."";
if (function_exists("rel2abs")) $WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
$WA_keepQueryString = false;
$WA_indexField = "id";
$WA_fieldNamesStr = "firstName|middleName|lastName|title|officeLocation|officeStreet|officeStreet2|officeCity|officeState|officeZip|officeHours|officePhone|officeFax|email|bio|specialities|education|researchInterest|photo|pub1|pub2|pub3|pub4|pub5|pub6|pub7|pub8|pub9|pub10|publicationLink";
$WA_fieldValuesStr = "".((isset($_POST["firstName"]))?$_POST["firstName"]:"") ."" . "|" . "".((isset($_POST["middleName"]))?$_POST["middleName"]:"") ."" . "|" . "".((isset($_POST["lastName"]))?$_POST["lastName"]:"") ."" . "|" . "".((isset($_POST["title"]))?$_POST["title"]:"") ."" . "|" . "".((isset($_POST["officeLocation"]))?$_POST["officeLocation"]:"") ."" . "|" . "".((isset($_POST["officeStreet"]))?$_POST["officeStreet"]:"") ."" . "|" . "".((isset($_POST["officeStreet2"]))?$_POST["officeStreet2"]:"") ."" . "|" . "".((isset($_POST["officeCity"]))?$_POST["officeCity"]:"") ."" . "|" . "".((isset($_POST["officeState"]))?$_POST["officeState"]:"") ."" . "|" . "".((isset($_POST["officeZip"]))?$_POST["officeZip"]:"") ."" . "|" . "".((isset($_POST["officeHours"]))?$_POST["officeHours"]:"") ."" . "|" . "".((isset($_POST["officePhone"]))?$_POST["officePhone"]:"") ."" . "|" . "".((isset($_POST["officeFax"]))?$_POST["officeFax"]:"") ."" . "|" . "".((isset($_POST["email"]))?$_POST["email"]:"") ."" . "|" . "".((isset($_POST["bio"]))?$_POST["bio"]:"") ."" . "|" . "".((isset($_POST["specialities"]))?$_POST["specialities"]:"") ."" . "|" . "".((isset($_POST["education"]))?$_POST["education"]:"") ."" . "|" . "".((isset($_POST["researchInterest"]))?$_POST["researchInterest"]:"") ."" . "|" . "".((isset($_FILES["photo"]))?$_FILES["photo"]["name"]:"") ."" . "|" . "".((isset($_POST["pub1"]))?$_POST["pub1"]:"") ."" . "|" . "".((isset($_POST["pub2"]))?$_POST["pub2"]:"") ."" . "|" . "".((isset($_POST["pub3"]))?$_POST["pub3"]:"") ."" . "|" . "".((isset($_POST["pub4"]))?$_POST["pub4"]:"") ."" . "|" . "".((isset($_POST["pub5"]))?$_POST["pub5"]:"") ."" . "|" . "".((isset($_POST["pub6"]))?$_POST["pub6"]:"") ."" . "|" . "".((isset($_POST["pub7"]))?$_POST["pub7"]:"") ."" . "|" . "".((isset($_POST["pub8"]))?$_POST["pub8"]:"") ."" . "|" . "".((isset($_POST["pub9"]))?$_POST["pub9"]:"") ."" . "|" . "".((isset($_POST["pub10"]))?$_POST["pub10"]:"") ."" . "|" . "".((isset($_FILES["publicationLink"]))?$_FILES["publicationLink"]["name"]:"") ."";
$WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''";
$WA_comparisonStr = "=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);

$WA_where_fieldValuesStr = "".((isset($_POST["WADAUpdateRecordID"]))?$_POST["WADAUpdateRecordID"]:"") ."";
$WA_where_columnTypesStr = "none,none,NULL";
$WA_where_comparisonStr = "=";
$WA_where_fieldNames = explode("|", $WA_indexField);
$WA_where_fieldValues = explode("|", $WA_where_fieldValuesStr);
$WA_where_columns = explode("|", $WA_where_columnTypesStr);
$WA_where_comparisons = explode("|", $WA_where_comparisonStr);

$WA_connectionDB = $database_connTPSS;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$updateParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WhereObj = WA_AB_generateWhereClause($WA_where_fieldNames, $WA_where_columns, $WA_where_fieldValues, $WA_where_comparisons );
$WA_Sql = "UPDATE `" . $WA_table . "` SET " . $updateParamsObj->WA_setValues . " WHERE " . $WhereObj->sqlWhereClause . "";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?>


I really need to solve this problem today. Let me know if I need to move to a support ticket.

Thanks again for your help. - Joe

Sign in to reply to this post

Jason ByrnesWebAssist

I have created a support ticket so we can look into this issue further.

To view and edit your support ticket, please log into your support history:
supporthistory.php

If anyone else is experiencing this same issue, please append to this thread.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

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.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...