CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Validating uploaded File

Print topic Send  topic

Author Message
sweiss

Posts: 22
Posted: 08/12/2004, 4:00 AM

Hi,

i want to validate if a uploaded image has the right width. So i wrote some custome code into the "Before Process File" section:

$the_pic=$form->picture->GetValue();
$pic_string = "/tmp/".$the_pic;
$size = GetImageSize ($pic_string,&$info);
if($size[0] <> 175){
$pictest->Errors->addError("Please check the picture. Must have a witdh of 175 pixels!");
}

The error will be displayed if the width of a file is not 175 pixels but the form will be completely proccessed, Record is written into database and the uploaded file will be moved from "/tmp/ to the picture directory. But this is exactly not what i want. If the error occours nothing should be written into the database.

Where is my error?

Regards

Stefan
View profile  Send private message
Damian
Posted: 08/12/2004, 4:16 PM

Different approach - I let them upload whatever image size they want (well,
to a reasonable level) and then use a thumbnail.php to resize image on
display...

thumbnail.php?gd=2&src=images/{image_name}&maxw=175



"sweiss" <sweiss@forum.codecharge> wrote in message
news:5411b4de8b8caa@news.codecharge.com...
> Hi,
>
> i want to validate if a uploaded image has the right width. So i wrote
some
> custome code into the "Before Process File" section:
>
> $the_pic=$form->picture->GetValue();
> $pic_string = "/tmp/".$the_pic;
> $size = GetImageSize ($pic_string,&$info);
> if($size[0] <> 175){
> $pictest->Errors->addError("Please check the picture. Must have a witdh of
175
> pixels!");
> }
>
> The error will be displayed if the width of a file is not 175 pixels but
the
> form will be completely proccessed, Record is written into database and
the
> uploaded file will be moved from "/tmp/ to the picture directory. But this
is
> exactly not what i want. If the error occours nothing should be written
into
> the database.
>
> Where is my error?
>
> Regards
>
> Stefan
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

sweiss

Posts: 22
Posted: 08/16/2004, 6:56 AM

Hello Damian,

can you post your thumbnail.php?

Regards

Stefan


Quote Damian:
Different approach - I let them upload whatever image size they want (well,
to a reasonable level) and then use a thumbnail.php to resize image on
display...

thumbnail.php?gd=2&src=images/{image_name}&maxw=175



"sweiss" <sweiss@forum.codecharge> wrote in message
news:5411b4de8b8caa@news.codecharge.com...
> Hi,
>
> i want to validate if a uploaded image has the right width. So i wrote
some
> custome code into the "Before Process File" section:
>
> $the_pic=$form->picture->GetValue();
> $pic_string = "/tmp/".$the_pic;
> $size = GetImageSize ($pic_string,&$info);
> if($size[0] <> 175){
> $pictest->Errors->addError("Please check the picture. Must have a witdh of
175
> pixels!");
> }
>
> The error will be displayed if the width of a file is not 175 pixels but
the
> form will be completely proccessed, Record is written into database and
the
> uploaded file will be moved from "/tmp/ to the picture directory. But this
is
> exactly not what i want. If the error occours nothing should be written
into
> the database.
>
> Where is my error?
>
> Regards
>
> Stefan
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>


View profile  Send private message
Damian
Posted: 08/18/2004, 3:50 AM

Its not my script... you can download it from here:

http://www.hotscripts.com/Detailed/18800.html

Damian


"sweiss" <sweiss@forum.codecharge> wrote in message
news:54120bd13a3379@news.codecharge.com...
> Hello Damian,
>
> can you post your thumbnail.php?
>
> Regards
>
> Stefan
>
>
>
Quote Damian:
> Different approach - I let them upload whatever image size they want
(well,
> to a reasonable level) and then use a thumbnail.php to resize image on
> display...
>
> thumbnail.php?gd=2&src=images/{image_name}&maxw=175
>
>
>
> "sweiss" <sweiss@forum.codecharge> wrote in message
>news:5411b4de8b8caa@news.codecharge.com...
> > Hi,
> >
> > i want to validate if a uploaded image has the right width. So i wrote
> some
> > custome code into the "Before Process File" section:
> >
> > $the_pic=$form->picture->GetValue();
> > $pic_string = "/tmp/".$the_pic;
> > $size = GetImageSize ($pic_string,&$info);
> > if($size[0] <> 175){
> > $pictest->Errors->addError("Please check the picture. Must have a witdh
of
> 175
> > pixels!");
> > }
> >
> > The error will be displayed if the width of a file is not 175 pixels but
> the
> > form will be completely proccessed, Record is written into database and
> the
> > uploaded file will be moved from "/tmp/ to the picture directory. But
this
> is
> > exactly not what i want. If the error occours nothing should be
written
> into
> > the database.
> >
> > Where is my error?
> >
> > Regards
> >
> > Stefan
> > ---------------------------------------
> > Sent from YesSoftware forum
> > http://forums.codecharge.com/
> >
>
>
>
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

viper
Posted: 09/16/2004, 10:27 AM

:-) Hi,


Bye :-P

Add new topic Subscribe to topic   


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

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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