CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeChargeStudio.Discussion

 File upload problem

Print topic Send  topic

Author Message
Leon
Posted: 08/25/2003, 1:12 AM

Hi all!

I've been playing vith CCS for some time now and must say that I read quite
a bit of documentation but cant figure out how to upload file (no need to
change its name) and insert its name into database with rest of the
informations from grid form... All help is welcomed and most appreciated..


--

Best regards

Andrej

Andrej
Posted: 08/27/2003, 3:18 AM


Figured it out and mannaged to upload files :)

But now new problem arised.. What if someone doesn't upload a picture?
I'm working in CCS 2.1, PHP and MySQL

Well, thing is like this, I have simple Record form for name imput, and
FileUpload.
FileUpload has ControlSourceType: DatabasColumn and
ControlSource:"picture_name"

Now I have a Grid form to view data. It has two coloumns, first has Label
with ControlSource: "names" and in second is Image with
ControlSource:"picture_name", DataType: Text and DefaultValue:
"transparent.gif"

Thing is that when data is shown and there was no image uploaded I get only
placeholder and my "transparent.gif" is not shown, how to solve this?

I also set in MySQL that "picture_name" is varchar and has default value
"transparent.gif" but it is not entered in database when Record is
submited...

I just don't want that placeholder to be seen when no image is uploaded...

Please help,

Many thanks

Andrej

DonB
Posted: 08/27/2003, 5:43 AM

Please tell us what the problem turned out to be, and what you did to make
it work.

--
DonB

http://www.gotodon.com/ccbth


"Andrej" <magla@hi.hinet.hrREMOVETHIS> wrote in message
news:bii0gm$3od$1@news.codecharge.com...
>
> Figured it out and mannaged to upload files :)
>
> But now new problem arised.. What if someone doesn't upload a picture?
> I'm working in CCS 2.1, PHP and MySQL
>
> Well, thing is like this, I have simple Record form for name imput, and
> FileUpload.
> FileUpload has ControlSourceType: DatabasColumn and
> ControlSource:"picture_name"
>
> Now I have a Grid form to view data. It has two coloumns, first has Label
> with ControlSource: "names" and in second is Image with
> ControlSource:"picture_name", DataType: Text and DefaultValue:
> "transparent.gif"
>
> Thing is that when data is shown and there was no image uploaded I get
only
> placeholder and my "transparent.gif" is not shown, how to solve this?
>
> I also set in MySQL that "picture_name" is varchar and has default value
> "transparent.gif" but it is not entered in database when Record is
> submited...
>
> I just don't want that placeholder to be seen when no image is uploaded...
>
> Please help,
>
> Many thanks
>
> Andrej
>
>

Andrej
Posted: 08/27/2003, 7:18 AM

Well, as I said I'm quite new to this so I didn't know that for FileUpload
ControlSource is column that uploaded file filename will be written in...
Solved than :)

What I wonder is, why when no file is uploaded in this column, MySQL defined
default value is not entered and why when showing data, if filename field is
empty Image defrault value is not used??

Thanks

Andrej


"DonB" <~ccbth~@gotodon.com> wrote in message
news:bii91f$e7g$1@news.codecharge.com...
> Please tell us what the problem turned out to be, and what you did to make
> it work.
>
> --
> DonB
>
> http://www.gotodon.com/ccbth

DonB
Posted: 08/27/2003, 7:54 AM

My guess is that there is not a NULL stored in the column of you database
table. Having a NULL should be the only time the default value is used for
an INSERT. There is probably an empty string there, not a NULL. You should
check the value of the image "src" attribute to see if it really points to
the right path for your "transparent.gif". It surely does not because you
see the image placeholder icon.

--
DonB

http://www.gotodon.com/ccbth


"Andrej" <magla@hi.hinet.hrREMOVETHIS> wrote in message
news:biiej7$lbi$1@news.codecharge.com...
> Well, as I said I'm quite new to this so I didn't know that for FileUpload
> ControlSource is column that uploaded file filename will be written in...
> Solved than :)
>
> What I wonder is, why when no file is uploaded in this column, MySQL
defined
> default value is not entered and why when showing data, if filename field
is
> empty Image defrault value is not used??
>
> Thanks
>
> Andrej
>
>
> "DonB" <~ccbth~@gotodon.com> wrote in message
>news:bii91f$e7g$1@news.codecharge.com...
> > Please tell us what the problem turned out to be, and what you did to
make
> > it work.
> >
> > --
> > DonB
> >
> > http://www.gotodon.com/ccbth
>
>

Andrej
Posted: 08/27/2003, 10:06 AM


"DonB" <~ccbth~@gotodon.com> wrote in message
news:biigmd$o2v$1@news.codecharge.com...
> My guess is that there is not a NULL stored in the column of you database
> table. Having a NULL should be the only time the default value is used
for
> an INSERT. There is probably an empty string there, not a NULL. You
should

Well, I checked the data and it seems that if no file is selected NULL is
submited to database, as all empty fields do have NULL values. When I
changed column to NOT NULL i get error from CCS as it cant insert NULL value
in NOT NULL field... I have no ide why it doesn't trriger MySQL to write in
default value...

> check the value of the image "src" attribute to see if it really points to
> the right path for your "transparent.gif". It surely does not because you
> see the image placeholder icon.

"src" is OK I guess, it is: pictures/{picture_name} it points to folder
"pictures" and takes filename from "picture_name" column....

Problem is than when filename is NULL it doesn't use DefaultValue which is
"transparent.gif"
I simply do not wan't to see placeholder when there is no picture... Seems
like so simple task but...

Thanks

Andrej

DonB
Posted: 08/27/2003, 2:06 PM

One other way to do this is to put a Label control on the page. Set it's
data type to "html". Then you can use its BeforeShow event to insert the
html for an <IMG> ... </IMG> tag when there IS an image file and leave it
blank when there is none. Depending on you database skills, you might work
out a way to return the IMG tag directly from the datasource by
constructing/concatenating a string with the appropriate html in one column
of the query. Then you can bind the Label to this column and eliminate the
need for event coding (the necessary html would get generated right out of
the database).

--
DonB

http://www.gotodon.com/ccbth


"Andrej" <magla@hi.hinet.hrREMOVETHIS> wrote in message
news:biioeo$2dg$1@news.codecharge.com...
>
> "DonB" <~ccbth~@gotodon.com> wrote in message
>news:biigmd$o2v$1@news.codecharge.com...
> > My guess is that there is not a NULL stored in the column of you
database
> > table. Having a NULL should be the only time the default value is used
> for
> > an INSERT. There is probably an empty string there, not a NULL. You
> should
>
> Well, I checked the data and it seems that if no file is selected NULL is
> submited to database, as all empty fields do have NULL values. When I
> changed column to NOT NULL i get error from CCS as it cant insert NULL
value
> in NOT NULL field... I have no ide why it doesn't trriger MySQL to write
in
> default value...
>
> > check the value of the image "src" attribute to see if it really points
to
> > the right path for your "transparent.gif". It surely does not because
you
> > see the image placeholder icon.
>
> "src" is OK I guess, it is: pictures/{picture_name} it points to folder
> "pictures" and takes filename from "picture_name" column....
>
> Problem is than when filename is NULL it doesn't use DefaultValue which is
> "transparent.gif"
> I simply do not wan't to see placeholder when there is no picture...
Seems
> like so simple task but...
>
> Thanks
>
> Andrej
>
>


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.