close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Help integrating DFP into site.

Thread began 8/19/2009 8:35 am by chrisbjax | Last modified 8/21/2009 1:01 pm by Jason Byrnes | 1631 views | 4 replies |

chrisbjax

Help integrating DFP into site.

Hello all,
I am new to Digital File Pro, so please be gentle. :)
I will start by explaining what I am attempting to accomplish.
I am tasked with building an intranet support matrix, for quick relevant troubleshooting steps for our helpdesk to view and assist in entry level troubleshooting before escalation.

the directory is named "supportgrid"
The index page, consist of a simple table, that echos the form data in an easy to read manner and is ordered by application/system. (See screenshot below.)



when adding a new system, I have a form for creating new entries named addnew.php



This op-test perfect, and works as expected.
Now on to what I want to accomplish.
As you can see from "Attach File" link at the top, this leads to a new page, called attachfile.php.
This page is very simple, in that all it offers is the file field, and an upload button.



Now here is where it gets fuzzy, so bear with me, I will attempt to explain.
What I want this to do, is to post the file to the directory, and then link the path of the file to a column in the database, so that the link can to echo'd on the listing page.

So essentially process would be: from attachfile.php page, they browse to file, select it, click upload. File is shown below as successfully uploaded, the page is redirected back to the form, and the attached file is now show at the bottom of the form, so when the completed form is submitted, the path the file is stored in the database, but the file itself resides in a directory name "uploads".

Would anyone be able to lend assistance? If you need any more information, please feel free, I will do my best to elaborate.

Thank you for any help you can provide.
Chris

Sign in to reply to this post

chrisbjax

Still not working.

I've been working on this all day, and I still don't understand whats wrong.

Would someone mind looking at my code, to tell me where the issue lies. I'm following the instructions verbatim, reading, and re-reading them to make sure I haven't missed a step, yet this product doesn't seem upload a file. I'm beeen watching both the global WA debug and the php debug, and it just doesn't work..

php:
<?php require_once('../../../Connections/conUDS.php'); ?>

<?php 
require_once("../../../WA_DigitalFilePro/HelperPHP.php"); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  if (
PHP_VERSION 6) {
    
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}

mysql_select_db($database_conUDS$conUDS);
$query_rsAttach "SELECT * FROM supportgrid";
$rsAttach mysql_query($query_rsAttach$conUDS) or die(mysql_error());
$row_rsAttach mysql_fetch_assoc($rsAttach);
$totalRows_rsAttach mysql_num_rows($rsAttach);?>
<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_2 Start
$WA_UploadResult1_Params["WA_UploadResult1_2"] = array(
    
'UploadFolder' => "uploads",
    
'FileName' => "[FileName]",
    
'DefaultFileName' => "../../../images/misc/space.gif",
    
'ResizeType' => "0",
    
'ResizeWidth' => "0",
    
'ResizeHeight' => "0",
    
'ResizeFillColor' => "" );
// WA_UploadResult1_2 End
// WA_UploadResult1 Params End
?>
<?php
WA_DFP_SetupUploadStatusStruct
("WA_UploadResult1");
if(isset(
$_POST["submit"])){
    
WA_DFP_UploadFiles("WA_UploadResult1""attachment""0""""false"$WA_UploadResult1_Params);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script  src="../../../WA_DigitalFilePro/jquery-blockui-formprocessing.js" type="text/javascript"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test Upload Form</title>
</head>

<body>
<h1>Test Upload Form</h1>
<div id="test1_ProgressWrapper">
<form  action="" method="post" name="test" id="test1">
<input name="attachment" type="file" id="attachment" />
<input name="submit" type="submit" id="submit" value="submit" />
</form>
</div>
<h2>WA Debug Info</h2>
<div>
<?php echo WA_DFP_AllUploadsDebug(); ?>
</div>
<div id="test1_ProgressMessageWrapper" class="blockUIOverlay" style="display:none;">
<script type="text/javascript">
WADFP_SetProgressToForm('test1', 'test1_ProgressMessageWrapper', WADFP_Theme_Options['BigSpin:CaboSunset']);
</script>
<div id="test1_ProgressMessage" >

    <p style="margin:10px; padding:5px;" ><img  src="../../../WA_DigitalFilePro/images/cabo-largespin.gif" alt="" title="" style="vertical-align:middle;" />&nbsp;&nbsp;Please wait</p>

</div>
</div>
<h2>PHP Debug</h2>
<div>
<?php
error_reporting
(E_ALL);
ini_set('display_errors','on');
?>
</div>
</body>
</html>
<?php
mysql_free_result
($rsAttach);
?>
Sign in to reply to this post

Jason ByrnesWebAssist

For a file to upload, the forms encoding type must be set to multipart/form-data:

<form action="" method="post" enctype="multipart/form-data" name="test" id="test1">

Sign in to reply to this post

chrisbjax

ACK!
That was it! Thank you Jason.
Would you mind giving me some advise on how to pass this back to my form as a link to the file, so it can be added as an entry per my original post?

Sign in to reply to this post

Jason ByrnesWebAssist

If you have eCart or Cookies Toolkit, you can add a set session value server behavior to the page to capture the server file name. Then on your insert page, create a hidden form element that uses the session variable as the value, in the insert record server behavior, bind the file column to the hidden form element.

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...