By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,712 Members | 1,440 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,712 IT Pros & Developers. It's quick & easy.

preview problem

P: n/a
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.
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
In article <6r********************@newsb.telia.net>,
Martin S <ma****@skjoldebrand.org> wrote:
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.


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, <de*****@cauce.org> is een "spam trap".
E-mail adres is <jpk"at"akamail.com>, waarbij "at" = @.
Jul 17 '05 #2

P: n/a
Regarding this well-known quote, often attributed to Martin S's famous
"Fri, 16 Apr 2004 05:46:42 GMT" speech:
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.


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
Jul 17 '05 #3

P: n/a
In article <1e****************************@40tude.net>, FLEB wrote:
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.


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

--
http://home.mysth.be/~timvw
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.