Gossamer Forum
Home : Products : Gossamer Links : Discussions :

file problem with modify

Quote Reply
file problem with modify
Hello,

When I modify an existing link with a file, and I wish to keep that file, I always need to upload it again, if I ignored this, I get no attached file in my validate_changes, how can I solve this?????

this does not work:

<input type="file" size="25" value="<%if File%><%File%><%endif%>">

Quote Reply
Re: file problem with modify In reply to
 
I'd have to look at this, but it sounds like a bug in the logic of the modify system, where the "filetype" field is updated, rather than left "as is" if no value is supplied. It's assuming an 'empty value' is akin to a 'delete'. Perhaps?



PUGDOG´┐Ż Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: file problem with modify In reply to
I hope that you can find a solution for it, because this is a rather strange problem that should be solved.





Quote Reply
Re: file problem with modify In reply to
Hi Pugdog,

I found this one about a week ago also:

http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=157780;sb=post_latest_reply;so=DESC;forum_view=forum_view_collapsed;

Not sure if Alex or anyone from GT has looked into it as there's no reply.

Cheers,
R.
Quote Reply
Re: file problem with modify In reply to
We have facing same problem too!



TheFox
Quote Reply
Re: [TheFox] file problem with modify In reply to
Hello

I investigated the problem, and I came to the conclusion:

The major problem is that you can't add a value on a file type

<input type="file" value="<%file%>"> or something could not work. it stays empty

The modify function needs the value to (re)enter the information (empty value is no value).

The only suggestion I can give is to create 2 seperate forms, one with, and one without the file input field.
the user can choose the form depending on their wish to modify/delete the file.


I hope that other users have better suggestions.

Quote Reply
Re: [TheFox] file problem with modify In reply to
Hello

I investigated the problem, and I came to the conclusion:

The major problem is that you can't add a value on a file type

<input type="file" value="<%file%>"> or something could not work. it stays empty

The modify function needs the value to (re)enter the information (empty value is no value).

The only suggestion I can give is to create 2 seperate forms, one with, and one without the file input field.
the user can choose the form depending on their wish to modify/delete the file.


I hope that other users have better suggestions.

Quote Reply
Re: [ridesworld] file problem with modify In reply to
Hi,

That's ok, when you validate the change, it should not erase the file, but rather if one wasn't specified it just keeps it there.

You can't use a value tag as it's a security risk (image hiding a type=file form field with value="c:\autoexec.bat" or "/etc/passwd" or something similiar.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: fix In reply to
Hi, you have definitely found a bug. Making the following changes should fix the problem.

In the file admin/GT/SQL/Table.pm file, around line 2808, you will see the following code.

Code:
if (exists $c->{$col}->{not_null} and $c->{$col}->{not_null} and (!exists $input->{$col} or ($input->{$col} =~ /^\s*$/))) {

Right after this line please place the following code.

Code:
if ( uc $c->{$col}->{form_type} eq 'FILE' ) {
my ( $pk ) = $self->pk();
$input->{$col} = $self->file_info( $col, $input->{$pk} ) and next;
}

This should fix the problem.
Quote Reply
Re: [Aki] fix In reply to
I experienced the same problem and tried your fix.
I still have a message saying the File field cannot contain the '' value.
Moreover I would appreciate having a link to the existing file displayed below the upload box (as it is done in the admin part of LinkSQL).