close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Files not uploading to server using File Manipulation Upload

Thread began 6/25/2014 12:50 am by rgolab68503 | Last modified 6/25/2014 4:20 pm by Jason Byrnes | 1118 views | 10 replies |

rgolab68503

Files not uploading to server using File Manipulation Upload

Hi there, I just tried creating a few content pages that require some pictures to be uploaded. First I was getting the files to update to the database but no files were uploaded. I then went through this tutorial several times ...
http://www.webassist.com/tutorials/Add-file-fields-to-Data-Bridge-insert-update-pages
And now I am not even getting the picture file names to be posted to the database. Could you please have a look at the attached files to see where I've gone wrong?

I should mention that I am using file uploader with my product catalog and it is working fine there.

Sign in to reply to this post

Jason ByrnesWebAssist

to troubleshoot, edit the insert page so that it no longer redirects, change:

$WA_redirectURL = "content_detail.php?ID=[Insert_ID]";



to:

$WA_redirectURL = "";



then add the following code at line 1 to turn on error reporting:

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



and in the page body, add the following code to write the FILES array contents to the page and the upload debug info:

<?php if (isset($_POST["Insert"]) || isset($_POST["Insert_x"])) { ?>
<?php echo $WA_Sql; ?>
<pre>
<?php var_dump($FILES); ?>
</pre>
<?php echo WA_DFP_AllUploadsDebug(); ?>
<?php } ?>



post back the results after trying the insert again.

Sign in to reply to this post

rgolab68503

Hi Jason,

I did this only to the "Insert" page (should I do the same with the "update" page?) and this is what I got ...

On top:

Warning: move_uploaded_file(/var/www/html/dtele/dadmin/../dtel/picture1/73e52238c20cd33edf6d96a396883b66_tmp.jpg): failed to open stream: Permission denied in /var/www/html/dtele/webassist/file_manipulation/helperphp.php on line 94 Warning: move_uploaded_file(): Unable to move '/tmp/phpRvbBDE' to '/var/www/html/dtele/dadmin/../dtel/picture1/73e52238c20cd33edf6d96a396883b66_tmp.jpg' in /var/www/html/dtele/webassist/file_manipulation/helperphp.php on line 94 Warning: copy(/var/www/html/dtele/dadmin/../dtel/picture1/73e52238c20cd33edf6d96a396883b66_tmp.jpg): failed to open stream: No such file or directory in /var/www/html/dtele/webassist/file_manipulation/helperphp.php on line 96 Warning: move_uploaded_file(/var/www/html/dtele/dadmin/../dtel/picture2/7adc7e799df7f308a65cbc5d464e2872_tmp.jpg): failed to open stream: Permission denied in /var/www/html/dtele/webassist/file_manipulation/helperphp.php on line 94 Warning: move_uploaded_file(): Unable to move '/tmp/phpwJj3gO' to '/var/www/html/dtele/dadmin/../dtel/picture2/7adc7e799df7f308a65cbc5d464e2872_tmp.jpg' in /var/www/html/dtele/webassist/file_manipulation/helperphp.php on line 94 Warning: copy(/var/www/html/dtele/dadmin/../dtel/picture2/7adc7e799df7f308a65cbc5d464e2872_tmp.jpg): failed to open stream: No such file or directory in /var/www/html/dtele/webassist/file_manipulation/helperphp.php on line 96

Below it says ...

INSERT INTO `page_content` (`page_name`,`page_title`,`para1`,`pict1`,`para2`,`pict2`,`para3`,`pict3`) VALUES ('Tirephone','Tires with phones','
and in the page body, add the following code to write the FILES array contents to the page and the upload debug info
','','
and in the page body, add the following code to write the FILES array contents to the page and the upload debug info
','','','')

Notice: Undefined variable: FILES in /var/www/html/dtele/dadmin/content_insert.php on line 384
NULL
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
Status object: WA_UploadResult2
statusCode : -1
errorMessage :
clientFileName :
fileExtension :
serverFileName :
serverSimpleFileName :
serverDirectory :
contentType :
fileWasOverwritten :
fileWasSkipped :
fileWasRenamed :
fileSize : -1
isImage :
imageWidth : -1
imageHeight : -1
WA_UploadResult2_1:
clientFileName :
fileExtension :
serverFileName :
serverSimpleFileName :
serverDirectory :
contentType :
fileSize : -1
imageWidth : -1
imageHeight : -1
Status object: WA_UploadResult3
statusCode : 0
errorMessage : No file uploaded
clientFileName :
fileExtension :
serverFileName :
serverSimpleFileName :
serverDirectory :
contentType :
fileWasOverwritten :
fileWasSkipped :
fileWasRenamed :
fileSize : -1
isImage :
imageWidth : -1
imageHeight : -1
WA_UploadResult3_1:
clientFileName :
fileExtension :
serverFileName :
serverSimpleFileName :
serverDirectory :
contentType :
fileSize : -1
imageWidth : -1
imageHeight : -1
statusCode : 0
errorMessage : No file uploaded

Sign in to reply to this post

Jason ByrnesWebAssist

ok, the error at the top is the heart of the problem:

Warning: move_uploaded_file(/var/www/html/dtele/dadmin/../dtel/picture1/73e52238c20cd33edf6d96a396883b66_tmp.jpg): failed to open stream: Permission denied in /var/www/html/dtele/webassist/file_manipulation/helperphp.php on line 94


this means the upload folder does not haver proper permissions for saving the uploaded file.

edit the permissions for the upload folder to 777 to allow write access which will allow the files to be saved on the server.

Sign in to reply to this post

rgolab68503

Thanks jason,

This did the trick for this. What confused me is that in the product catalogue it is set to 755 and the pictures upload properly. but if this works then great. Thanks again.

Sign in to reply to this post

rgolab68503

Another quick question kind of the same topic i hope. For the update page it is now allowing the files to be uploaded. However the page has 3 pictures to upload. If i go to update say only one of them then it wipes out the other two. Or if I simply update some text it wipes them all out. I have tried a bunch of things form what was described in the tutorial to binding the file names to the upload but it keeps overwriting what is there for file uploads. Any ideas there?

Attached Files
content_update.php
Sign in to reply to this post

Jason ByrnesWebAssist

You have it mostly set up, you added the hidden fields, and your using the column bindings for the hidden field values.

you just need to edit the file upload behaviors, and bind the Default File Setting to the hidden fields.

Sign in to reply to this post

rgolab68503

That did it Jason. Thanks for that. One more question ... and sorry for this one, i am sure you are chuckling after this one ... for some reason right from the start if i upload a file it "adds" a .jpg to the end of the file name. If it is already a JPEG it adds a JPG to it so picture.jpg ends up picture.jpg.jpg. When i update it again it adds another .jpg to the end of it making it a new file with an additional .jpg to it. To top it off say i try to change a picture and it was called picture.jpg.jpg and the new pictures name is frog.jpg. Rather than "overwrite" it as is the setting i have it keeps the old name and just adds the .jpg to it. i know I won;t make a lot of changes to each but worst part the plan is if the field is empty (no picture for that content page) i was going to use a "show if" command. The field always has a .jpg in it so something will always show up. Shouldn't the "overwrite" command simply rename the file?

Attached Files
content_insert.php
content_update.php
Sign in to reply to this post

Jason ByrnesWebAssist

your trying to force the file name using the file name binding:
'FileName' => "".((isset($_FILES["pict2"]))?$_FILES["pict2"]["name"]:"") ."",

or the recordset binding:

'FileName' => "".$row_WADApage_content['pict3'] ."",


instead, just use the default file name setting:

'FileName' => "[FileName]",


this tels it to use the name of the file that is being uploaded as the file name.

Sign in to reply to this post

rgolab68503

That did it Jason. updates fine and doesn't drop in the .jpg in a blank picture. Thanks again.

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