Gossamer Forum
Home : Products : DBMan : Customization :

uploaded image doesn't show

Quote Reply
uploaded image doesn't show
I have a strange problem here. I have installed the mods Preview, Validate and at last the single Upload.
All works well, but.....
when I add an image it doesn't show up in the preview, in the record_added, in the search results and in the modify screen. After I modified and uploaded the image again it DOES shows up in the modified succes screen and the validated screen and the delete results screen. But then it does NOT show up in the screens as said above! Stranger; in the Photo-field of the search results there are 2(?) pictures not showing up!!! (if there is no picture added, then a default picture will show up) One is pointing to the uploaddirectory but not to the image, and the second is pointing to the domain.
Strange things can happen, but now I lost my way in dbman. The preview and the validate mods are working perfect.

The dbman is located here for testing;
http://www.famspekschoor.nl/cgi-bin/dbman/db.cgi

and the files are here;
http://www.famspekschoor.nl/test/db.txt
http://www.famspekschoor.nl/test/default.txt
http://www.famspekschoor.nl/test/html.txt

Any help appreciated!
Ton

I checked on the server and all the images I tested (.jpg + .gif) are uploaded and are in the right directory.
Looking in default.db I noticed that the url to the images is not written to the database. What went wrong?
Quote Reply
Re: uploaded image doesn't show In reply to
Hello Ton, it appears you may have added code to sub html_record_form (in html.pl) which belonged in sub html_record (you have it copied there too)

I may have looked at the mod wrong :-) however, this is the only thing I see added to sub html_record_form

|;
if ($form_upload) {
print qq|
<TR><TD>Browse Picture:</TD>
<TD><INPUT TYPE="FILE" NAME="Filename" SIZE="50"></TD></TR>|;
}
print qq|

I did not see this line added in sub html_record, try adding the line as instructed in the mod:

my (%rec) = @_; # Load any defaults to put in the VALUE field.
($db_auto_generate and print &build_html_record(%rec) and return);
$rec{$db_key} =~ s/<.?B>//g;


Quote Reply
Re: uploaded image doesn't show In reply to
You are absoluty right!!! The mod said to copy it where ever you want it, so I copied it also in the sub html_record_form. After making the corrections you suggested it is possible to view the images as intended!
But only after when I modify the record again. Should it be possible to view the uploaded image when you look at the preview or when I get the add_succes screen? Have you any suggestions to get it working at once?

Thank you Karen very much for looking and poiting it out.
I would never see the mistake.
You made me happy, and I will sleep well this night!


Quote Reply
Re: uploaded image doesn't show In reply to
Ton, if you could save your htmp.pl file with the changes as a textfile again, I'd be happy to take a look to see if we could locate whatever is causing the preview display problem. Just post here in the forum again after you've uploaded the new text file.

:-)

Quote Reply
Re: uploaded image doesn't show In reply to
The changes are made and uploaded to;

The dbman is located here for testing;
http://www.famspekschoor.nl/cgi-bin/dbman/db.cgi

and the files are here;
http://www.famspekschoor.nl/test/db.txt
http://www.famspekschoor.nl/test/default.txt
http://www.famspekschoor.nl/test/html.txt
Indeed, on the same place.

For the url in the database, I figured this one out;
it uses the recordnumber off the record, so there is no url needed.( I was confused with Webdata, another database script which did so.)

So the last question here is;
why does it not show up when added, only after modifying it?
I really hope you can help me out of this.
Thank you Karen, for your help so far.

Ton

Quote Reply
Re: uploaded image doesn't show In reply to
Ton, let's try the easiest change first :-)

In this section of sub html_record

my (%rec) = @_; # Load any defaults to put in the VALUE field.
($db_auto_generate and print &build_html_record(%rec) and return);
$rec{$db_key} =~ s/<.?B>//g;


Try moving $rec{$db_key} =~ s/<.?B>//g; so the segment looks like this:

my (%rec) = @_; # Load any defaults to put in the VALUE field.
$rec{$db_key} =~ s/<.?B>//g;
($db_auto_generate and print &build_html_record(%rec) and return);

Let me know if that resolves the problem.

Quote Reply
Re: uploaded image doesn't show In reply to
I'm sorry Karen, but I thought thats just what there is in the html.pl file. I made a copy of it and it looks like;

my (%rec) = @_;
$rec{$db_key} =~ s/<.?B>//g;

($db_auto_generate and print &build_html_record_form(%rec) and return);

Do you mean the other way around or are we getting to the difficult part?

Quote Reply
Re: uploaded image doesn't show In reply to
Hi Ton, my apologies for not being more clear. You've made the change in sub html_record_form. Could you also try making the change in sub html_record a little further down in the file?

Right now in sub html_record, you have:

my (%rec) = @_; # Load any defaults to put in the VALUE field.
($db_auto_generate and print &build_html_record(%rec) and return);
$rec{$db_key} =~ s/<.?B>//g;

I'd like for you to change it to:

my (%rec) = @_; # Load any defaults to put in the VALUE field.
$rec{$db_key} =~ s/<.?B>//g;
($db_auto_generate and print &build_html_record(%rec) and return);




Quote Reply
Re: uploaded image doesn't show In reply to
Jee, my apologies, stupid me. You were right. Maybe i'm to anxious to get it to work...maybe I need a pair off glasses...(getting in the midlife-crises, I hear all around me!)
So I did made the change but still the image will not upload when adding or previewing the record. I checked the upload-folder and only when I modify the record, then it appears in the folder and in the record...
I will stare at the sub html_modify for a while.

The .txt files are changed and on the same spot.
Thanks for the quick reaction!

Ton.


Quote Reply
Re: uploaded image doesn't show In reply to
In Reply To:
...(getting in the midlife-crises, I hear all around me!)
I've heard a lot about that crisis lately too! It must be a global problem. Crazy

One last try for resolving the problem within html.pl before we plead for assistance from AstroBoy to check over code conflicts Smile

In sub html_record_form (make sure you get the _form sub :-) it looks as though the db_key entry doesn't belong there.

Can you try changing the following section:

my (%rec) = @_;
$rec{$db_key} =~ s/<.?B>//g;

($db_auto_generate and print &build_html_record_form(%rec) and return);

to:

my (%rec) = @_;
($db_auto_generate and print &build_html_record_form(%rec) and return);



Quote Reply
Re: uploaded image doesn't show In reply to
I'm terribly sorry to tell you after all your effort to make it happen, but....
no changes in the procedure; no image when preview, added or list all. Only after modifying and uploading again it apears.
I will check the html.pl for uneven brackets or()'s.
Did you install the upload-mod and did it work when adding the picture for the first time?

Thanks, Ton

Quote Reply
Re: uploaded image doesn't show In reply to
So I did, but all brackets seems te be OK;


Left Round = 153
Right Round = 155
Left Curly = 112
Right Curly = 112
Left Square = 8
Right Square = 8
Quotations = 1162

I was glad to see that there was an oneven number of left/right-round, but looking closer it was a smiley :-) and a forgotten left-round in a piece of text. So we can leaf the brackets out.

What else is there to do to get it to work?
Any suggestions left?



Quote Reply
Re: uploaded image doesn't show In reply to
Ton, I'm not sure Crazy Since you've provided textfiles on all three modified files, I'm going to try duplicating the problems on a production server where I can also have access to server logfiles. See if there's any hint there. Won't be able to do this until late tonight however. I'll let you know how it goes.

Quote Reply
Re: uploaded image doesn't show In reply to
.......meanwhile I tried to put the multiple-upload-mod in, but that didn't worked out either. So maybe I should forget the preview and the validate mod's and start over with al clean dbman and only the multiple-upload-mod.
To be continued......

Quote Reply
Re: uploaded image doesn't show In reply to
Ton, it would seem that during the "Preview" stage of adding a record, the file is not yet uploaded - I've been able to get things to work showing your default image during the Preview but, until the new record is actually Added to the database, there is no upload of the user's file.

Quote Reply
Re: uploaded image doesn't show In reply to
CoolWow!!! That's more then I ever achieved....
I hope you didn't have to work on it to hard/long. Was it a typo? a curly left to much? ot a conflict? I'm very anxious to know and to see the result!
Thanks for your wonderful work sofar!!!Laugh

Quote Reply
Re: uploaded image doesn't show In reply to
Ton, the only real change I made was in adding a backslash in the email address variable of the default.cfg file.

# Your email address
$admin_email = 'name\@domain.com';

I sent you a note directly.


Quote Reply
Re: uploaded image doesn't show In reply to
If you have your email written using single quotes such as:

# Your email address
$admin_email = 'name\@domain.com';

it is not necessary to include the backslash. You may not receive your email with the backslash included. It is only necessary is you have your variable defined using quotes such as:

# Your email address
$admin_email = "name\@domain.com";

Just thought I would mention that Smile


Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: uploaded image doesn't show In reply to
I was just updating the FAQ noted below and added a some thread relating to the image upload mode.

I did notice as I was preparing these threads the following:

I figured out my problem. As I'm using the preview mod, I had to add:

if (($status eq "ok") && ($in{'Filename'})) { $status = &validate_upload; } #Validate Picture

at the beginning of this subroutine.

Perhaps this will help with your use having the validation and preview mods being used with the image upload. If not, perhaps the new threads I added under "Images" might help.


Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: uploaded image doesn't show In reply to
Well....I tried all the possible changes in the inoffical FAQ but the inage will only upload after modifying. I als changed the action to the ENCTYPE in the sub_preview to make sure it should upload when hitting the preview button, but no way.....
A quote from JPDeni on the same problem;
In Reply To:
Response: JPDeni

I don't know if I can resolve the conflict between previewing and uploads. I'm thinking that I probably can't.

You will probably have to choose between using one mod and the other.
I saw her dbman+multi=upload working as it should so maybe I willl forget about the preview; after adding the record you can see the addition made in the database. To keep the database clean I would rather keep the validation in it. Or maybe as JPDeni did; sent them an email for the login. This will keep also unwanted entries away!
I posted the desired dbman + mods in the installer-forum. Maybe somebody could help me there?
Maybe I will start from fresh and build the dbman as JPDeni did. It has to work that way!

Quote Reply
Re: uploaded image doesn't show In reply to
Hello Ton, I used a fresh install with the multiple file uploads and it is working nicely. Haven't had a chance to attempt adding the preview to it yet. You can review it at the same url as before.