PDA

View Full Version : file upload.


i.edwards384429
06-13-2010, 01:48 AM
Hi

Back against the wall for this project, got to get it on line within two weeks;-(

My initial problem is that I have used the solution pack to create a user registration sequence and I need to allow users to upload initially five photos.

I have the latest version of Universal email and I downloadedthe "adding digital file pro to dataassist insert pages..."

Below is exactly what I did and in what order but I fail at the instruction "from the Server behavious panel" double click on insert record" because I do nopt have that option listed.

Would appreciate any hints. (below is my sequence)

thanks

Ian

ON a site created using user registration module I need to allow the upload of images so I selected the page:

users_Profile.php

I selected the table.WAAATKTable and altered the number of rows to 16

I then opened my mysql database and added five fields called: UserImage1, userImage2 etc
the definition is varchar, length 20, decimals 0, allow null is ticked


Placed curser in the area I wanted image 1

on the form bar I selected the option file field

in the id field I typed UserImage1

and I left the label field empty

next I pressed OK.

I now have a field with a browse icon.



next I selected insert----webassist---file manipulation---upload

I left "1" as is apart from selecting web image

on the second menu I used the yellow folder icon to browse to and select the folder model_images which I created

previously. I selected the resize option fit width 500

Finaly I selected "finish"

Went to the Server behavious panel but I see no option for Insert Record.

Jason Byrnes
06-14-2010, 08:53 AM
Do you have DataAssist Installed? You will need DataAssist to edit the Insert record Behavior on the profile page.

Once you have installed DataAssist, you will be able to Double Click the Insert record server behavior.

You will need to bind each image column to the appropriate Server File name variable from the Uploaded Files (File Field Name) Group on the bindings panel.

i.edwards384429
06-14-2010, 11:51 AM
Hi Jason

I do have dataassist installed and if I go to insert--webassist--dataassit --I see the wizard, the search wizard and the repeating table option.

However if I click on the server behavious panel I see no insert record to double click on. I do have an update record option to double click on but no insert record.

Where do I go form here

thanks

Ian

Jason Byrnes
06-14-2010, 12:54 PM
what page are you working with? The profile page? If it is the profile page, you need to edit the Update record Behavior.

i.edwards384429
06-16-2010, 06:00 AM
Hi

in my ongoing project I create a test website using the user registration solution.

Created the database and added one field called image which is varchar, length 100.

If I now open users_profile and add a file filed with the id image the image appears on the form.

SO far so good.

If I then double click on the server behavior update record I get the error

sql type not recognised: "

if I ok the error three times then I get the update record general configuration screen up.

The connection to the database is ok and I can register as a user and the data appears in the table

I have tried the usual deleting the Dw cache, deleting the database and reinstalling

Any ideas?

thanks

Ian

i.edwards384429
06-16-2010, 06:09 AM
Hi

forgot to say

I've uninstalled digital download because I have universal emai installed.

When I look at server behaviours the email behaviour has a red exclamation and a note telling me it's anold version I double clicked to update to the latest version.

Might have no relavence but .....

cheers

Ian

i.edwards384429
06-17-2010, 04:36 AM
Hi Jason

went back to basics listed below is exactly what I did step by step. End product is teh image is uploaded but the database is not updated.

I've clearly missed a step

would appreciate an assist

cheers

Ian

installed virgin database and core files.

Opened up page

exclamtion on Universal email [prior version]

Selected update Record (users) in the server behaviours field

Update record window opened normaly

Canceled out of that window.

Double clicked on the Universal email server behaviour

Create emial message opened.

Pressed finish

exclamtion mark against Universal email dissapears.

Double clicked on uPdate record server behaviour

That opened the update record wizard normally.

Went into the database using phpmyadmin

added a field:

Name:UserImage1
type:varchar
length:100
0
allow null

default: NULL
Character set: latin1
Collation: latin1_swedish_ci

Saved and closed

went back to Dreamweaver and double clicked update record
Update record wizard opened OK

Added a row to the table.

Went to the form menu and added a file upload field with an id of UserImage1

Selected insert...webassist.....file manipulation---upload

selected:

trigger: any form post
file field: UserImage1
Action: overwrite

on next page:
for the upload folder I used the browse icon to select images/
the rest I left at the defaults.

Pressed finish.

Selected server behaviours update record

pressed next to go to next screen

SElected The colum named: userimage

pressed the lightning bolt to set value

was unable to see WA upload file but did find " upload files (UserImage1)

Opened this and found Server File Name- slected this and selected OK and finish

saved the file users_profile.php

opened in my local host

registered - data is written into the users table

then logged in to the users_Profile.php

used the browse button to select an image jpeg 70kb in size

pressed the update button

progress bar goes accross.

In the specified images folder is the image

but if I open the users table in phpmyadmin the userimage column is empty ie no path to the file.

i.edwards384429
06-17-2010, 08:24 AM
Hi Jason

I have made some progress in that from the usersregistration I can now upload images.

The users profile is proving difficult.

This is waht I did


I first added a line to the table

and then inserted a text field.

I used ctrl T and changed the input type to hidden.
the code for this icon is :
<input type="hidden" name="textfield" id="textfield">


I placed my curser next to the hidden filed and added a form file field field with an ID of UserImage.

The selected insert---wa---file manipulation---file upload and set the default directory to images/ on page 2

Here's where I think I'm going wrong

I press the lightening bolt next to default file

I scrolled down to find the form field called texfield


Under WATKUpdateform I see listed the textfield whiuch I highlighted and clicked Ok

I then selected the behavior update record

selected userImage

and then clicked the lightening bolt to scroll down.

I see two entries

1.Uplod files global status

2. Upload files user image

I selected the second and highlighted

Server file name


Clicked OK

If I the preview and uplaod a file then the file uploaded with the sequence in User Registrationn is deleted and no mofified entry is added into the database. However the image is uploaded


Any ideas, I know it's me ;-)

thanks

Ian

Jason Byrnes
06-17-2010, 08:50 AM
send a copy of the profile page so I can examine the code, the steps sound correct, the code will tell the true story.

i.edwards384429
06-17-2010, 09:17 AM
Hi Jason

been on this for two days ;-(

the code for the update page is in zip
hope you can see my error

thanks

Ian

Jason Byrnes
06-17-2010, 10:09 AM
instead of copying the code from the page into a text file, it is easier if you just adda copy of the original php file into a ip archive and send a copy of the php file.


I see 2 problems in the code:
1) The upload file server behavior iis on the page after the Update record server behavior. This means the record is updated before the Server File name variable is created by the DFP Upload file server behavior.

The upload file code needs to before the update record code.

2) The hidden form element does not have a value.

Select the hidden form element in design view.
In the property inspector, click the lightning bolt next to initial value and select the UserImage column from the WAATKusers recordset.

i.edwards384429
06-17-2010, 02:59 PM
Hi Jason

changed the code as you said but still no upload can you check the altered code please.

As it stands it does not upload the new file and deletes the original image from the database

thanks

Ian

Jason Byrnes
06-17-2010, 05:39 PM
only part of the upload code was moved. This code at line 131 - 145:


<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "images/",
'FileName' => "[FileName]",
'DefaultFileName' => "".((isset($_POST["textfield"]))?$_POST["textfield"]:"") ."",
'ResizeType' => "0",
'ResizeWidth' => "0",
'ResizeHeight' => "0",
'ResizeFillColor' => "" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End
?>



needs to be moved to line 75.

you did not properly bind the hidden form element to the recordset, you bound it to the value from the form. When binding the hidden form element, you need to select the UserImage column from the WAATKusers recordset.

i.edwards384429
06-17-2010, 11:38 PM
Hi Jason

that problems sorted many thanks for the assist. One other issue I discovered was that when I added the additional image field I did not add them to the record set.

On to the next problem over the weekend;-)

thanks again

Ian

Jason Byrnes
06-18-2010, 06:39 AM
ok, glad to hear it is working.