File Upload Problems...
I can't seem to find the .PDF instructions for the Universal Email 4.0 upload server behavior...
I'm having a HUGE problem getting it to upload correctly...
Any help/links would rock!
Thanks,
Ted
I can't seem to find the .PDF instructions for the Universal Email 4.0 upload server behavior...
I'm having a HUGE problem getting it to upload correctly...
Any help/links would rock!
Thanks,
Ted
please send a copy of your page so I can examine the code.
<?php require_once("../webassist/file_manipulation/helperphp.php"); ?>
<?php require_once('../Connections/downloads.php'); ?>
<?php require_once("../WA_DataAssist/WA_AppBuilder_PHP.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_downloads, $downloads);
$query_uploads = "SELECT DISTINCT * FROM downloads";
$uploads = mysql_query($query_uploads, $downloads) or die(mysql_error());
$row_uploads = mysql_fetch_assoc($uploads);
$totalRows_uploads = mysql_num_rows($uploads);
mysql_select_db($database_downloads, $downloads);
$query_uploadUsers = "SELECT DISTINCT * FROM login";
$uploadUsers = mysql_query($query_uploadUsers, $downloads) or die(mysql_error());
$row_uploadUsers = mysql_fetch_assoc($uploadUsers);
$totalRows_uploadUsers = mysql_num_rows($uploadUsers);?>
<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "../downloads/",
'FileName' => "".((isset($_FILES["path"]))? preg_replace('/.[^.]*$/', '', $_FILES["path"]["name"]) :"") ."",
'DefaultFileName' => "",
'ResizeType' => "0",
'ResizeWidth' => "0",
'ResizeHeight' => "0",
'ResizeFillColor' => "" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["submit"])){
WA_DFP_UploadFiles("WA_UploadResult1", "path", "0", "", "false", $WA_UploadResult1_Params);
}?>
<?php
// WA Application Builder Insert
if (isset($_POST["submit"])) // Trigger
{
$WA_connection = $downloads;
$WA_table = "downloads";
$WA_sessionName = "downloads_uid";
$WA_redirectURL = "";
$WA_keepQueryString = false;
$WA_indexField = "uid";
$WA_fieldNamesStr = "username|path|filename";
$WA_fieldValuesStr = "".((isset($_POST["username"]))?$_POST["username"]:"") ."" . "|" . "".((isset($_FILES["path"]))? preg_replace('/.[^.]*$/', '', $_FILES["path"]["name"]) :"") ."" . "|" . "".((isset($_POST["filename"]))?$_POST["filename"]:"") ."";
$WA_columnTypesStr = "',none,''|',none,''|',none,''";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_downloads;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$insertParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WA_Sql = "INSERT INTO `" . $WA_table . "` (" . $insertParamsObj->WA_tableValues . ") VALUES (" . $insertParamsObj->WA_dbValues . ")";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
$_SESSION[$WA_sessionName] = mysql_insert_id();
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);
}
}
?>
form:
<form action="" method="post" enctype="multipart/form-data" name="upload" id="upload1">
<table cellpadding="2" cellspacing="4">
<tr>
<td>username:</td>
<td>
<select name="username">
<option selected="selected">- - - Select a User - - -</option>
<?php
do {
?>
<option value="<?php echo $row_uploadUsers['username']; ?>" ><?php echo $row_uploadUsers['username']; ?></option>
<?php
} while ($row_uploadUsers = mysql_fetch_assoc($uploadUsers));
?>
</select>
</td>
</tr>
<tr>
<td>file to upload:</td><td><input type="file" name="path" id="path" /></td>
</tr>
<tr>
<td>filename:</td><td><input type="text" name="filename" id="filename" size="50" /></td>
</tr>
<tr>
<td colspan="2" style="padding:10px;">
<input type="submit" name="submit" id="submit" value="Add Download" />
</td>
</tr>
</table>
</form>
Progress Bar:
<div id="upload1_ProgressMessageWrapper" class="blockUIOverlay" style="display:none;">
<script type="text/javascript">
WADFP_SetProgressToForm('upload1', 'upload1_ProgressMessageWrapper', WADFP_Theme_Options['Bar:Slate']);
</script>
<div id="upload1_ProgressMessage" >
<p style="margin:10px; padding:5px;" ><img src="../webassist/progress_bar/images/slate-bar.gif" alt="" title="" style="vertical-align:middle;" /> Please wait</p>
</div>
</div>
first off, leave the file name setting in the wizard as the default [FileName] instead of trying to bind to the file form element.
next add the following code at line 1 to turn on error reporting:
<?php
error_reporting(E_ALL);
ini_set('display_errors','on');
?>
then add this code after the body tag:
<?php echo WA_DFP_AllUploadsDebug(); ?>
back back the results after a test
The following is the report
Warning: move_uploaded_file(/var/www/vhosts/changecompanies.net/httpdocs/admin/../downloads/3463e2120317f5c522d85bd39edf5025_tmp.cfg) [function.move-uploaded-file]: failed to open stream: Permission denied in /var/www/vhosts/changecompanies.net/httpdocs/webassist/file_manipulation/helperphp.php on line 96
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpv84Q0a' to '/var/www/vhosts/changecompanies.net/httpdocs/admin/../downloads/3463e2120317f5c522d85bd39edf5025_tmp.cfg' in /var/www/vhosts/changecompanies.net/httpdocs/webassist/file_manipulation/helperphp.php on line 96
Warning: copy() [function.copy]: Unable to access /var/www/vhosts/changecompanies.net/httpdocs/admin/../downloads/3463e2120317f5c522d85bd39edf5025_tmp.cfg in /var/www/vhosts/changecompanies.net/httpdocs/webassist/file_manipulation/helperphp.php on line 98
Warning: copy(/var/www/vhosts/changecompanies.net/httpdocs/admin/../downloads/3463e2120317f5c522d85bd39edf5025_tmp.cfg) [function.copy]: failed to open stream: No such file or directory in /var/www/vhosts/changecompanies.net/httpdocs/webassist/file_manipulation/helperphp.php on line 98
Status object: WA_UploadResult1
statusCode : -1
errorMessage :
clientFileName :
fileExtension :
serverFileName :
serverSimpleFileName :
serverDirectory :
contentType :
fileWasOverwritten :
fileWasSkipped :
fileWasRenamed :
fileSize : -1
isImage :
imageWidth : -1
imageHeight : -1
WA_UploadResult1_1:
clientFileName :
fileExtension :
serverFileName :
serverSimpleFileName :
serverDirectory :
contentType :
fileSize : -1
imageWidth : -1
imageHeight : -1
ok - I'm an idiot...
I figured out I don't have the folder set for 0777 - do now...
But the "file" uploaded is the name and not the actual file... It's the name of the file minus the extension...
<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "/downloads",
'FileName' => "[FileName]",
'DefaultFileName' => "",
'ResizeType' => "0",
'ResizeWidth' => "0",
'ResizeHeight' => "0",
'ResizeFillColor' => "" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if($_SERVER["REQUEST_METHOD"] == "POST"){
WA_DFP_UploadFiles("WA_UploadResult1", "path", "0", "", "false", $WA_UploadResult1_Params);
}
?>
this means that the folder you have set for the files to upload to does not have the appropriate permissions to allow the file to be created.
make sure the upload folder has read and write permissions for all users.
OK... I have the permissions set correctly - yes I AM a dumbass - and I can't seem to get the extension and file name passed in...
can you send the actual php page in a zip archive, it's easier to inspect the code that way.
Thanks for the help Jason - I really do appreciate it...
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.