Gossamer Forum
Home : Products : Gossamer Links : Pre Sales :

Attachement & Co

Quote Reply
Attachement & Co
It seems, noone is interested in things around attachements & co.
So i have killed this thread.

I have moded my links so, that i(admin) and users could upload x attachements at one time, proofe on file-format and size, saving in the right format and not as .fil, and they could be modified from users and admin, too...

Now im working on proofing gif and jpg picturesize for width and height in pixel :-)
and on doing things with pics to show, but ram or pdfs as files ...

If someone wants to know more write your questions; to do a doc is too much at this time, sorry.
Quote Reply
Re: Attachement & Co In reply to
Hi Robert,

I did the same thing. But I still have following Problems:

1. When resync'ing my .def with the SQL Tables via admin the path to the upload-dirs in the .def gets ereased.

2. Checking image size ( not filesize ) of jpg's and gif's

If you find a solution please leave a msg.

regards, alexander

Quote Reply
Re: Attachement & Co In reply to
in dbsql there are: ATTACH-DELETE and ATTACH-DEL?

While i cant find ATTACH-DEL anywhere i have set it to ATTACH-DELETE


Robert



Quote Reply
Re: Attachement & Co In reply to
Hi Alex404, finally it comes true:

Find in dbsql.pm: sub write_to_file {

# Print the database connect info.
my ($package) = $file =~ m#([^/]+)\..{1,4}$#;
print OUT "package Links::DBSQL::$package;\n\n";
-----> replace all from here with
if ($package eq "Links"){
$self->{'attach_dir'} = "/home/.../pages/Detailed/ups";
}

if ($package eq "Validate"){
$self->{'attach_dir'} = "/home/.../pages/Detailed/tmp";
}

foreach (@DB_FIELDS) {
print OUT " \$$_ = '", $self->{$_}, "';\n";
}
print OUT "\n";

--- end of replacement
# Print the db_def.

Now its your job to do it with the vars from links.pm. So we could share the work :-)

Robert
Quote Reply
Re: Attachement & Co In reply to
Hi Robert,

In dbsql.pm insert

use Links;

and the replace the absolute paths with:

Links
$self->{'attach_dir'} = $LINKS{attach_dir};

Validate
$self->{'attach_dir'} = $LINKS{temp_attach_dir};

regards, alexander

Quote Reply
Re: Attachement & Co In reply to
Yeah, Thank you.

BTW: I have now the following done:

Add with n Attachements with add.cgi
Killem directly from the admin-validate-form
Delete, mod or add with the admin-modify
Add with admin

But i still suck while doing it with the modify.cgi;
its because modify use another way than add in add_record (dbsql)

I have tried to pass it with another hash
so in modify add_record ($links, $new_hash) like in add add_record($rec, $in)

...

Robert


Quote Reply
Need help with modify In reply to
Hi all,
im still stuck at the point to let users modify there uploads, too.
I really dont understand the different way add.cgi and modify.cgi passes data to add_record in dbsql.
Has someone fix this?

Robert

Quote Reply
Re: Need help with modify In reply to
One suggestion is to remove the attached file if it is being updated (look at the codes in the user.cgi to check original usernames and inputted usernames) and if the value is different, then remove the attached file (either through del or system functions, although using system functions in a public script is quite dangerous in terms of security). If the value is the same, then leave it alone.

I know you have probably thought about this logic thoroughly, but I thought I would throw in my two cents.

Regards,

Eliot Lee
Quote Reply
Re: Need help with modify In reply to
Hi Anthro, thank you for the hint; i think i have done all the things to erase data in links_attach and kill the file;
i could work as user with add.cgi and as admin with add and MODIFY.
But i stuck on doing it as a user with modify.cgi.

This is cause modify.cgi passes the values on another way to add_record than add.cgi

modify: add_record($links)
add: add_record($rec, $in)

so i have to got my field:

$in->param('ATTACH-ADD') somehow in $links but not with

$links->{'ATTACH-ADD'} = $in->param('ATTACH-ADD');

it must be cgi_to_hash´ed like in add.cgi
where it reads:

$rec=&cgi_to_hash($in);
$id = $val->add_record ( $rec, $in );


Maybe the solution is not to pass
$links=&cgi_to_hash($in);
$val->add_record ( $links, $in );

while with this i erase all values in $links, but somehow add
$in->param('ATTACH-ADD'); with cgi_to_hash only to $links

Maybe?!

I dont know if i need all values in $rec and $in parallel like in add.cgi

Robert