Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Problem using upload-function

Quote Reply
Problem using upload-function
I am trying to use the upload function. I inserted the following field in the template add.html:

<input type="file" name="ATTACH-ADD" enctype="multipart/form-data">

When the form is submitted I get the following errormessage:

Software error:
Can't use string ("C:\test.jpg") as a symbol ref while "strict refs" in use at admin/Links/DBSQL.pm line 768.

does anybody have an idea whats going wrong?

Quote Reply
Re: Problem using upload-function In reply to
Hi Alex,

You want:

<FORM ... ENCTYPE="multipart/form-data">
...
<INPUT TYPE=FILE name="ATTACH-ADD">

The multipart part needs to be in the <FORM> tag not in the <INPUT> tag.

Cheers,

Alex
Quote Reply
Re: Problem using upload-function In reply to
Thanks for the quick answer,

I changed the HTML, but the error is still the same.

Thanks,
Alexander
Quote Reply
Re: Problem using upload-function In reply to
Do uploads work from the admin? If not, you may be using an old version of CGI.pm. If possible, try putting the newest version on at:

http://www.perl.com/...dules/by-module/CGI/

Cheers,

Alex
Quote Reply
Re: Problem using upload-function In reply to
Hi Alex,

I updated the CGI.pm

When adding a link form admin.cgi I now get the following error:

Software error:
CGI open of tmpfile: No such file or directory

Frown
Quote Reply
Re: Problem using upload-function In reply to
I found the problem. It was CGI.PM unable to access the tmp directory. Thanks to all bothering about it.

Now how can I access these uploaded files in the templates? Are there any tags for them?

It would be a great feature!
Quote Reply
Re: Problem using upload-function In reply to
Not yet, no. If you look at jump.cgi starting at line 90, you'll see how you can get the data. Basically you need to do something like:

$att_list = $db->list_attach (SOMEIDNUMBER);

$att_list is an array ref of hash refs. So you could do:

foreach my $attach (@$att_list) {

}

and $attach can access any of:

ServerName
FileName
FileType
FileSize

fields. Let me know how you would want to access them in the template (remember there can be more then one attachment per link) and I can give you some tips.

Cheers,

Alex

Quote Reply
Re: Problem using upload-function In reply to
Hi,

I'd like to use the uploads the following way:

1. Append one image to be viewed in the detailed page.

or

2. Append one file of any kind that can be viewed / dowloaded by a link in the detailed page (Word Documents, AVIs, mpeg's etc.)

And I want the users to have the option to upload an other file or keeping the old one when modifying.

Alexander
Quote Reply
Re: Problem using upload-function In reply to
Hi

Is anyone out there also having problems with the modify.cgi not treating uploaded files correctly?

Modifing with admin.cgi works fine. But when a user uploads a file via modify.cgi the admin-validation form does not display any attachements. (the file itself gets copied and validated) If you validate this link all other attachements get mixed-up.

Anybody got an idea whats going wrong?