close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Upload image file not working

Thread began 4/09/2009 5:14 am by roby258376 | Last modified 4/13/2009 8:14 am by roby258376 | 6641 views | 19 replies |

roby258376

Upload image file not working

I am having a problem getting images to upload.

I am trying to change my "edit profile" page to allow users to upload a new image. I have followed the tutorial, but it says in the last step to open up the "WA Update Record" server behaviour. I do not have that server behaviour, the only thing I have that comes close is "Update Record (WAATKUpdateForm, members, members). I created the form with Data Assist so I'm not sure why I don't have the right server behaviour.

So, my questions are:

1) does DFP only work with Data Assist? or is it supposed to work with any update form?

2) is there something I'm missing that allows a new file to be uploaded?

My update page works great, for every element except the image. Without adding the DFP functionality, I can change the name of the image file, and it updates in the database, but I cannot of course, upload a new image.

When I try to add the DFP functionality to upload an image, it deleted the information currently in the database and doesn't upload the picture.

Any help would be appreciated, I'm tearing my hair out.

p.s. I did add the debug info to the page, but since I'm new to this, it doesn't really help me.

Sign in to reply to this post

Ray BorduinWebAssist

It works with DataAssist (or hand code)... some upload extensions don't allow you to specify values from bindings, which prevents them from working properly without hand code... The page was probably created with SecurityAssist and not DataAssist... you may need to reapply the server behavior because securityassist uses the standard DW Insert/Update which don't work properly with file uploading.

Sign in to reply to this post
Did this help? Tips are appreciated...

roby258376

Thank Ray, I've been having all sorts of problems with DataAssist, so you could be right that the page I'm updating from was created with Security Assist.

Can you give me some instruction on how to reapply the right server behaviour to get this to work?

Sign in to reply to this post

Ray BorduinWebAssist

Open the existing server behavior for insert or update and copy the redirect page.

Then remove the server behavior and apply the corresponding insert or update server behavior from dataassist pasting in the same redirect page and using the bindings to set the values of the database columns including your upload field.

Sign in to reply to this post
Did this help? Tips are appreciated...

roby258376

Again Ray, thank you for your quick reply.

So, I followed your instructions, removed the old server upload behaviour and added a Data Assist one.

I then followed the instructions in the tutorial and everything works fine except for the file upload. The images are not being uploaded and renamed properly, to the folder I designated, and the name of the file, in the database field is not updating.

Any suggestions? Any help is appreciated.

Sign in to reply to this post

Ray BorduinWebAssist

Well if the file isn't uploaded properly then of course other things may not work, so concentrate on that.

What exactly happens? Do the files get uploaded at all? Most likely this is a file permissions issue.

Sign in to reply to this post
Did this help? Tips are appreciated...

roby258376

Well, it seems that prior to removing the server behaviour that was generated by Security Assist, and replacing it with the one from site Assist, the image was being uploaded and renamed in the folder that I designated in the Digital File Pro Wizard. However, the database field was not being updated with the file name information, so nothing was showing up on my pages for the image.

Now that I've deleted the Security Assist server behaviour and generated one with Site Assist, I'm not getting an update to the database and the image is not being uploaded either. All the other database fields update, but when I browse for a new image and then click submit. The page reloads and the new information is no where to be found.

I've tried setting permission but that doesn't seem to be helping either.

Sign in to reply to this post

Ray BorduinWebAssist

OK, so maybe the file upload code was placed below the database insert or update code, so that it hasn't been uploaded at the time of the database update and then you redirect and the upload code never runs... that seems possible based on your description.

Sign in to reply to this post
Did this help? Tips are appreciated...

roby258376

I checked and it appears that the upload code is prior to the update code. but I'm including that part of the page below. If you can see anything out of place, well, let's just say, you'll see it WAY before I do :)

<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["Update_x"])){
WA_DFP_UploadFile("WA_UploadResult1", "pictureFile", "".((isset($_POST["picture"]))?$_POST["picture"]:"") ."", "../images/members/", "".$row_WAATKmembers['lastName'] ."", "2", "[FileName]_[Increment]", "0", "true", "150", "0");
}
?>
<?php
// WA Application Builder Update
if (isset($_POST["Update_x"])) // Trigger
{
$WA_connection = $members;
$WA_table = "members";
$WA_redirectURL = "";
$WA_keepQueryString = false;
$WA_indexField = "UserID";
$WA_fieldNamesStr = "lastName|firstName|member_status|company|title|address|city|province_state|pc_zip|telephone|fax|cell_phone|email|url|business_category|picture";
$WA_fieldValuesStr = "".((isset($_POST["lastName"]))?$_POST["lastName"]:"") ."" . "|" . "".((isset($_POST["firstName"]))?$_POST["firstName"]:"") ."" . "|" . "".((isset($_POST["member_status"]))?$_POST["member_status"]:"") ."" . "|" . "".((isset($_POST["company"]))?$_POST["company"]:"") ."" . "|" . "".((isset($_POST["title"]))?$_POST["title"]:"") ."" . "|" . "".((isset($_POST["address"]))?$_POST["address"]:"") ."" . "|" . "".((isset($_POST["city"]))?$_POST["city"]:"") ."" . "|" . "".((isset($_POST["province_state"]))?$_POST["province_state"]:"") ."" . "|" . "".((isset($_POST["pc_zip"]))?$_POST["pc_zip"]:"") ."" . "|" . "".((isset($_POST["telephone"]))?$_POST["telephone"]:"") ."" . "|" . "".((isset($_POST["fax"]))?$_POST["fax"]:"") ."" . "|" . "".((isset($_POST["cell_phone"]))?$_POST["cell_phone"]:"") ."" . "|" . "".((isset($_POST["email"]))?$_POST["email"]:"") ."" . "|" . "".((isset($_POST["url"]))?$_POST["url"]:"") ."" . "|" . "".((isset($_POST["business_category"]))?$_POST["business_category"]:"") ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"] ."";
$WA_columnTypesStr = "',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 = "".$_SESSION['UserID'] ."";
$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_members;
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);
}
}
?>
Sign in to reply to this post

Ray BorduinWebAssist

It looks correct to me. But your statement:

"it seems that prior to removing the server behaviour that was generated by Security Assist, and replacing it with the one from site Assist, the image was being uploaded and renamed in the folder that I designated in the Digital File Pro Wizard"

must not be correct then... I don't see how code after the upload could effect code before.

Is the recordset : WAATKmembers above both of these?

Sign in to reply to this post
Did this help? Tips are appreciated...
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...