Connecting Tech Pros Worldwide Help | Site Map

preview problem

Martin S
Guest
 
Posts: n/a
#1: Jul 17 '05
I have a form that sends data on to another page so that the user can
preview it before it is inserted in a database table.

The problem is that the form sends both text and possibly an image to
the page used for preview. Even if I use a hidden input field for the
image file it still is displayed on the text centric page but with
enctype for foo bars the image into gibberish that fills a large part of
the preview page.

How can I pass the image on to the preview page without it being
"displayed"? (Image is validated later).


/M.
Jan Pieter Kunst
Guest
 
Posts: n/a
#2: Jul 17 '05

re: preview problem


In article <6rKfc.56258$mU6.232645@newsb.telia.net>,
Martin S <martin@skjoldebrand.org> wrote:
[color=blue]
> I have a form that sends data on to another page so that the user can
> preview it before it is inserted in a database table.
>
> The problem is that the form sends both text and possibly an image to
> the page used for preview. Even if I use a hidden input field for the
> image file it still is displayed on the text centric page but with
> enctype for foo bars the image into gibberish that fills a large part of
> the preview page.
>
> How can I pass the image on to the preview page without it being
> "displayed"? (Image is validated later).
>
>
> /M.[/color]

Store it in a temp directory on the server, and pass on a reference to
the image in a hidden variable to the preview page?

Just the first thing that comes to mind.

JP

--
Sorry, <devnull@cauce.org> is een "spam trap".
E-mail adres is <jpk"at"akamail.com>, waarbij "at" = @.
FLEB
Guest
 
Posts: n/a
#3: Jul 17 '05

re: preview problem


Regarding this well-known quote, often attributed to Martin S's famous
"Fri, 16 Apr 2004 05:46:42 GMT" speech:
[color=blue]
> I have a form that sends data on to another page so that the user can
> preview it before it is inserted in a database table.
>
> The problem is that the form sends both text and possibly an image to
> the page used for preview. Even if I use a hidden input field for the
> image file it still is displayed on the text centric page but with
> enctype for foo bars the image into gibberish that fills a large part of
> the preview page.
>
> How can I pass the image on to the preview page without it being
> "displayed"? (Image is validated later).
>
>
> /M.[/color]

You can't put an image inline into HTML code. You have to save it somewhere
on the server, and make an <IMG SRC=""> tag, and possibly a hidden value or
session variable so the app knows where to find the image if the submission
is acceptable.

Remember: Never trust the user. Make sure that image is an image file
before you display it. You don't want your site "displaying" a .php file
they uploaded as an image.

--
-- Rudy Fleminger
-- sp@mmers.and.evil.ones.will.bow-down-to.us
(put "Hey!" in the Subject line for priority processing!)
-- http://www.pixelsaredead.com
Tim Van Wassenhove
Guest
 
Posts: n/a
#4: Jul 17 '05

re: preview problem


In article <1erkvpwgqikp4.i5t29h1k36r1.dlg@40tude.net>, FLEB wrote:[color=blue]
> Remember: Never trust the user. Make sure that image is an image file
> before you display it. You don't want your site "displaying" a .php file
> they uploaded as an image.[/color]

Remember that only looking at the extension of a file is not a good idea
either.

--
http://home.mysth.be/~timvw
Closed Thread