upload - return to the calling script or make it in single file

hello group,

in upload form on action a php script is called. How to return from
this script to the calling page?
Or maybe it could be done in such a way that all the code resides in
one file, action script is a php function somehow initiated?

Andra.
kkadrese [ Mi, 21 Februar 2007 13:48 ] [ ID #1638196 ]

Re: upload - return to the calling script or make it in single file

<kkadrese [at] yahoo.com> wrote in message
news:1172062117.118275.164890 [at] s48g2000cws.googlegroups.com.. .
| hello group,
|
| in upload form on action a php script is called. How to return from
| this script to the calling page?

either leave the 'action' out all together, or make it point to
$_SERVER('PHP_SELF')

| Or maybe it could be done in such a way that all the code resides in
| one file, action script is a php function somehow initiated?

put a hidden input in the form named something like 'inputSubmitted' (or
just name the submit button in the same way) and check at the beginning of
the page script - take the desired actions you want.

if ($_REQUEST['inputSubmitted'])
{
// check to see if anything was actually submitted
// check to see if upload was 'safe' (free of viruses and strip [or
comment out] anything that php may mistakenly execute)
// check to see that file attributes meet business/internal rules (file
size, nomanclature, etc.)
// show messages/warnings/errors related to the transaction
// relocate uploaded 'safe' file(s) (either to different path or store in
db)
}

// this is where your current page code beings

hth
Steve [ Mi, 21 Februar 2007 18:31 ] [ ID #1638197 ]

Re: upload - return to the calling script or make it in single file

yes, thank you, it works - putting all into single file.

> | hello group,
> |
> | in upload form on action a php script is called. How to return from
> | this script to the calling page?
>
> either leave the 'action' out all together, or make it point to
> $_SERVER('PHP_SELF')
>
> | Or maybe it could be done in such a way that all the code resides in
> | one file, action script is a php function somehow initiated?
>
> put a hidden input in the form named something like 'inputSubmitted' (or
> just name the submit button in the same way) and check at the beginning of
> the page script - take the desired actions you want.
>
> if ($_REQUEST['inputSubmitted'])
> {
> // check to see if anything was actually submitted
> // check to see if upload was 'safe' (free of viruses and strip [or
> comment out] anything that php may mistakenly execute)
> // check to see that file attributes meet business/internal rules (file
> size, nomanclature, etc.)
> // show messages/warnings/errors related to the transaction
> // relocate uploaded 'safe' file(s) (either to different path or store in
> db)
> }
>
> // this is where your current page code beings
>
> hth
kkadrese [ Do, 22 Februar 2007 17:06 ] [ ID #1638206 ]

Re: upload - return to the calling script or make it in single file

glad it helped.
Steve [ Do, 22 Februar 2007 17:35 ] [ ID #1638208 ]
PHP » alt.php » upload - return to the calling script or make it in single file

Vorheriges Thema: Capture M$ username during NT Authentication
Nächstes Thema: php and flash