Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Upload / show images on forms

Locked
quintangai
Posts: 6
Joined: Wed Mar 02, 2011 4:02 pm

Upload / show images on forms

Unread post by quintangai »

Hi,
I am newbie with all php / JavaScript etc... coming from MS Access but I know nuBuilder since long when I made my first approach abou 2 years ago.
Now I believe it is more understandable to me and making my 1st app with simply 4 tables... all is up and running as expected except that I want to keep an image for product table and want it to be
uploaded/ shown on edit form

Up to now no complete luck, and that is why I am asking for advise.

Looking up this forum I got few ideas looking at SCimage form properties via myphpadmin ( why it is not shown when looged as globeadmin on forms browse ? )
there I have copied code for after update and JavaScript and made my version form my table of uploadimage.php found at production2 folder, etc...
Up to now I am almost there since I get the image uploaded to the table and can see the blob column filled at myphpadmin.

Final step whas creating an html object as suggested with sample code copied ... changed ... back to original.. etc but no luck to get the image of the record shown on edit form....

I don't ask for writing code for me... I'll keep trying and getting there for sure even losing a couple more of days....
but I am asking that you make a good example in a new version say for the employees table of samplenufinancial ...
since I am sure it will help a lot of people that need using images from blob columns...
As far as I have been able to search I have not found any simple tutorial of example anywhere of the forum or wiki

Sorry if it is a long post
Regards from Barcelona / Spain
quintangai
Posts: 6
Joined: Wed Mar 02, 2011 4:02 pm

Re: Upload / show images on forms

Unread post by quintangai »

Back again

As stated on my 1st post I could manage to make it, although I still have a small glitch ...
I made a small guide on how I made it, so that It may be useful for anyoneelse ....

Please see the attached zip file containing the guide and files I made.

Any comment will be much appreciated, so that I keep on learning this huge tool.

Regards
Attachments
images_on_forms.zip
(3.68 KiB) Downloaded 339 times
quintangai
Posts: 6
Joined: Wed Mar 02, 2011 4:02 pm

Re: Upload / show images on forms

Unread post by quintangai »

I have captured the screen message of the glitch I am fighting with...
This always happens once I uploaded the image to the table and press the SAVE button which calls formupdate.php and then crashes saying that image cannot be shown because it contains errors...
However if I go back to browse screen and reenter the form it shows the correct image that has correctly been uploaded and put in the table...so, the image does not contain errors... does it ??

I wonder if any of you can help me to find where is the glitch seeing the error message ... as far as I know it shold work, but it is not ...

Regards from Barcelona / Spain
Attachments
glitch.png
glitch.png (68.14 KiB) Viewed 7452 times
quintangai
Posts: 6
Joined: Wed Mar 02, 2011 4:02 pm

Re: Upload / show images on forms

Unread post by quintangai »

I just made a simple test and replaced the original formupdate.php with a copy of the also original form.php by renaming a copy of it.
Then I went to the form pressed the upload image button, upload one image and pressed Save button that calls formpudate.

It worked !! and I could see the form refreshed with the new image !!

Of course it did not update any other data, but confirmed me that the problem is almost for sure anywhere inside formupdate.php

I don't know what is the difference with my form and the SCimage form that does not have this problem,
but also I cannot follow the whole code of SCimage since It is a special system form and the image is not attached to any variable neither the "form belongs to" is filled, etc... at the form object html ... so you may have hardcoded things I do not know (yet)

Any comment would be much appreciated.

Have a g'day
Fike
Posts: 79
Joined: Thu Oct 20, 2011 9:13 pm

Re: Upload / show images on forms

Unread post by Fike »

Hi Quintangai,

I don't know what could be wrong in your database, but I was getting errors when trying to show files uploaded using the file object and the reason was the following:

Blob columns allow a maximum file size fo 64 kb. Therefore, when uploaded files are larger than 64 kb, they are not stored correctly in the database. Use MEDIUMBLOB/LONGBLOB instead of BLOB.

http://stackoverflow.com/questions/4097 ... ata-column

I hope this helps to solve your problem.

Regards,

Fike
quintangai
Posts: 6
Joined: Wed Mar 02, 2011 4:02 pm

Re: Upload / show images on forms

Unread post by quintangai »

Thanks for your comment but BLOB is not the problem since the image are correctly stored or they would not show when opening the form when coming from the browse screen...

As explained on my post the glitch only arises while I am at the edit form, upload any image to BLOB ( at this moment I know all is OK since I can see it from myphpadmin ) but when I press the Save button is when I get the error msg.
and as per the msg itself the problem should be at the formupdate.php

Anyway the problem is solved already, I think it was caused to a problem with formupdate.php faulty while uploaded to my server...or...
Maybe there is a difference in the linux version (my 1st download) and the uwamp windows version ...

In order to test I placed a copy on my laptop with your uwamp environment and all worked fine since the beginning,
so I uploaded all back again from my laptop to the server and is up and running.

Thanks for your time, and I hope my little tutorial if useful for anyone.

Regards from Barcelona / Spain
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Upload / show images on forms

Unread post by massiws »

.
Locked