Hi,

My assumption is that you want to upload a file, perform validation on it,
then upload to another server?

So the first step is to get the file, via the validators you mentioned.

After that you have the file on disk, validated.

Now all that is left to do is put/upload/copy/post the file to the server
you want.

Does that help :)




On 26 May 2015 at 21:09, cmple <[email protected]> wrote:

> Hi latterd,
> for my existing image upload validation I'm using multiple zf validators
> with custom error messages:
>
> array('Extension', true, array(
>         'extension' => explode(',', $this->config->valid_upload_types),
>         'messages' => array(
>                 'fileExtensionFalse' => 'Invalid picture type'
>         )
> )),
> array('IsImage', true, array(
>         'magicFile' => false,
> )),
> array('Size', true, array(
>         'max' => $this->config->max_upload_size,
>         'messages' => array(
>                 'fileSizeTooBig' => 'Picture size is too big'
>         ),
> )),
> array('ImageSize', true,
>         array(
>                 'minwidth' => $minSize->minwidth,
>                 'minheight' => $minSize->minheight,
>                 'maxwidth' => $this->config->max_width,
>                 'maxheight' => $this->config->max_height,
>                 'messages' => array(
>                         'fileImageSizeHeightTooBig' => 'Picture height is
> too big',
>                         'fileImageSizeWidthTooBig' => 'Picture width is
> too big',
>                 ),
>         ),
> ),
>
> are you suggesting that there is no way around this but only to create
> custom validations such as the use of the getimagesize() function?
>
> also is it possible to use getimagesize() before uploading the image to the
> server (even to the /tmp folder)?
>
> Thank You!
> Roman.
>
>
>
> latterd wrote
> > Hi,
> >
> > You can find out file information using:
> > http://php.net/manual/en/function.finfo-file.php
> >
> > Also, a common way is to use getimagesize() function, if it throws an
> > error
> > or returns false its not an image.
> >
> > I think it is a 2 step process, first you get the image from the url,
> > validate etc.
> >
> > Then upload/send to your server.
> >
> >
> >
> > On 26 May 2015 at 17:05, cmple &lt;
>
> > roman.vidyayev@
>
> > &gt; wrote:
> >
> >> Hey Alejandro,
> >> Thanks for your reply!
> >> I have one more question, how can I apply the file Validation without
> >> using
> >> the global $_FILES[] variable?
> >>
> >> for example:
> >> $validator = new Validator\IsImage();
> >> $valid = $validator->isValid();
> >>
> >> Thanks!
> >> Roman.
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://zend-framework-community.634137.n4.nabble.com/ZF2-Import-and-validate-external-pictures-from-URLs-tp4662542p4662545.html
> >> Sent from the Zend Framework mailing list archive at Nabble.com.
> >>
> >> --
> >> List:
>
> > [email protected]
>
> >> Info: http://framework.zend.com/archives
> >> Unsubscribe:
>
> > [email protected]
>
> >>
> >>
> >>
>
>
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/ZF2-Import-and-validate-external-pictures-from-URLs-tp4662542p4662547.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: [email protected]
> Info: http://framework.zend.com/archives
> Unsubscribe: [email protected]
>
>
>

Reply via email to