close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Upload file trouble while updating record.

Thread began 7/13/2011 1:01 am by BenoitBlouh | Last modified 8/04/2011 8:35 am by BenoitBlouh | 3151 views | 14 replies |

BenoitBlouh

Upload file trouble while updating record.

Hi,
I apologies for my bad english speaking.
I saw several times this problem on the forums but I can't fix it in my pages. I've tryed to follow this tutorial : dfp_da_insert_update_ht.pdf

When I replace the default input type to "hidden" instead of "text", the recorded name of my image stay good. That's a good point. BUT…
The problem is that when I try to update a record in my database with a new file field called "imageNEW" for example, the file doesn't upload, and it doesn't record the filename in the database.
If i just change the default input type to "file" instead as "text" it works only if I send another file. If I leave the field blank, the existant filename is erased from the database and the image cannot be displayed.

I don't understand what I have to do.
I've buy this extensions to help me developping websites by my own, but I can't…
And I need help :)

Attached Files
UpdateUploadFile.zip
Sign in to reply to this post

Jason ByrnesWebAssist

you have 2 problems in this page:

1) In the file upload behavior, you need to bind the default file to the image hidden form element.

In the server behaviors panel, double click the upload file server behavior to edit it.

On the second step of the upload file behavior, click the lightning bolt next to default file, from the forms collection select the image form element.


2) In the update record behavior, you need to bind the image column to the Uploaded Files (imageNew) -> Server file name variable from the bindings panel


In the server behaviors panel, double click the update record server behavior to edit it, on the second step of the Update record Behaor, select the image column, then click the lightning bolt next to value.

from the bindings panel, expand the Uploaded Files (imageNew) group, then select the server file name binding.

Sign in to reply to this post

BenoitBlouh

Thank you Jason.
I've updated my pages.

// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "../folio/categories/",
'FileName' => "[FileName]",
'DefaultFileName' => "".$row_WADAcategories['image'] ."",
'ResizeType' => "1",
'ResizeWidth' => "880",
'ResizeHeight' => "",
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult1_1 End

By doing this, when I select another image, its name is good recorded in the database. Goog thing :)

But i still have this problems.
1) The file is not uploaded
2) or its name disappears if i do not send a file in the file field.

I need some more help… :(

Attached Files
categories_Update.php.zip
Sign in to reply to this post

Jason ByrnesWebAssist

1) for the default file, you have bound to the image column from the recordset, you need to bind the default file to the file hidden form element

2) In the update record behavior, you have bound to the newFile element from the form collection, you need to use the Uploaded Files (imageNew) -> Server File Name.

3) To troubleshoot why the image is not uploading, add the following code at line 1:

php:
<?php
error_reporting
(E_ALL);
ini_set('display_errors','on');
?>



change the following line:
$WA_redirectURL = "categories_Results.php";

to:
$WA_redirectURL = "";

and add the following code just after the <body> tag:

php:
<?php if($_SERVER['REEQUEST_METHOD'] == "POST") echo(WA_DFP_AllUploadsDebug()); ?>
Sign in to reply to this post

BenoitBlouh

Ok…
It's done. Here is the result :

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /Volumes/LaCie3/htdocs/homdo_admin/admin/categories_Update.php:5) in /Volumes/LaCie3/htdocs/homdo_admin/admin/categories_Update.php on line 105
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

BenoitBlouh

Here is the line 105 :

if (!session_id()) session_start();

Sign in to reply to this post

Jason ByrnesWebAssist

try changing the following code:

php:
if(($_SERVER["REQUEST_METHOD"] == "POST") && (isset($_SERVER["HTTP_REFERER"]) && strpos(urldecode($_SERVER["HTTP_REFERER"]), urldecode($_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"])) > 0) && isset($_POST)){



to:

php:
if (isset($_POST["Update_x"])) {




for the error, see the following thread for detail on troubleshooting:
showthread.php?t=19285

Sign in to reply to this post

BenoitBlouh

Ok. I've change the line, and the file is uploaded and the name stay recorded if i don't send another file !! Great !
Can we considered the problem solved ?

There is still an error :

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /Volumes/LaCie3/htdocs/homdo_admin/admin/categories_Update.php:5) in /Volumes/LaCie3/htdocs/homdo_admin/webassist/file_manipulation/helperphp.php on line 70

Warning: Division by zero in /Volumes/LaCie3/htdocs/homdo_admin/webassist/file_manipulation/helperphp.php on line 885
Status object: WA_UploadResult1
statusCode : 1
errorMessage :
clientFileName : IMG_0097.jpg
fileExtension : jpg
serverFileName : IMG_0097.jpg
serverSimpleFileName : IMG_0097
serverDirectory : /Volumes/LaCie3/htdocs/homdo_admin/admin/../folio/categories/
contentType : image/jpeg
fileWasOverwritten :
fileWasSkipped :
fileWasRenamed :
fileSize : 62881
isImage : 1
imageWidth : 880
imageHeight : 660
WA_UploadResult1_1:
clientFileName : IMG_0097.jpg
fileExtension : jpg
serverFileName : IMG_0097.jpg
serverSimpleFileName : IMG_0097
serverDirectory : /Volumes/LaCie3/htdocs/homdo_admin/admin/../folio/categories/
contentType : image/jpeg
fileSize : 62881
imageWidth : 880
imageHeight : 660
isImage : 1
fileWasOverwritten :
fileWasSkipped :
fileWasRenamed :
statusCode : 1

Sign in to reply to this post

Jason ByrnesWebAssist

for the error, see the following thread for detail on troubleshooting:
showthread.php?t=19285

Sign in to reply to this post

BenoitBlouh

Thank you very much for helping Jason !

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