close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

File Upload Problems...

Thread began 10/15/2010 11:28 am by fdotmedia | Last modified 10/18/2010 7:07 am by Jason Byrnes | 2571 views | 15 replies |

fdotmedia

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

Sign in to reply to this post

Jason ByrnesWebAssist

please send a copy of your page so I can examine the code.

Sign in to reply to this post

fdotmedia

<?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;" />&nbsp;&nbsp;Please wait</p>

</div>
</div>
Sign in to reply to this post

Jason ByrnesWebAssist

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:
<?php
error_reporting
(E_ALL);
ini_set('display_errors','on');
?>




then add this code after the body tag:

php:
<?php echo WA_DFP_AllUploadsDebug(); ?>





back back the results after a test

Sign in to reply to this post

fdotmedia

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
Sign in to reply to this post

fdotmedia

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);
}
?>
Sign in to reply to this post

Jason ByrnesWebAssist

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.

Sign in to reply to this post

fdotmedia

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

Sign in to reply to this post

Jason ByrnesWebAssist

can you send the actual php page in a zip archive, it's easier to inspect the code that way.

Sign in to reply to this post

fdotmedia

Thanks for the help Jason - I really do appreciate it...

Attached Files
downloads-add.php.zip
Sign in to reply to this post
loading

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