Skip to main content
Inspiring
December 4, 2006
Answered

Uploading/ Inserting image file URL

  • December 4, 2006
  • 23 replies
  • 1095 views
running on LAMP.

After finding out that it is best to 'store' images as an address url link rather than in binary in the database itself, I have re-configured the filed definition to VARCHAR and entered some test addresses.

The I have put in a 'logos' directory under the root which will hold all the image files themselves.

I have then managed to get the results php pages to take the url address and display it as an image..

Going great so far.... Here's the crunch..

For both insert and update pages, I have used a form file field which browses the location and inserts it into the field - this does return an address into the field but when it submits, it doesn't save the image data. (Everything else does update OK). In fact, it seems to overwrite with a null value.

I have checked the insert and update behaviours but cannot find where I'm going wrong.

Field code:
<input name="LOGO" type="file" id="LOGO">

Update/Insert code:
GetSQLValueString($HTTP_POST_VARS['LOGO'], "text"),
This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer Newsgroup_User
On Wed, 6 Dec 2006 17:36:13 +0000 (UTC), "RichardODreamweaver"
<webforumsuser@macromedia.com> wrote:

>OMG - didn't realise - sorry...

No worries.

I have done a demo for you. It mimics (as far as I can) your database
table and I have pre-loaded the form with test data to save a lot of
typing. Use it to upload logos (jpg or gif format) and then view the
inserted records (and logos using the link provided). I have zipped
the two files and my test database table for your perusal. Note that
the form is not validated - it is just for testing purposes and was
quickly done.

I have emailed the link and files to you.

HTH
--
Steve
steve at flyingtigerwebdesign dot com

23 replies

Inspiring
December 4, 2006
On Mon, 4 Dec 2006 12:41:33 +0000 (UTC), "RichardODreamweaver"
<webforumsuser@macromedia.com> wrote:

> Going great so far.... Here's the crunch..
>
> For both insert and update pages, I have used a form file field which browses
>the location and inserts it into the field - this does return an address into
>the field but when it submits, it doesn't save the image data. (Everything else
>does update OK). In fact, it seems to overwrite with a null value.
>
> I have checked the insert and update behaviours but cannot find where I'm
>going wrong.
>
> Field code:
> <input name="LOGO" type="file" id="LOGO">
>
> Update/Insert code:
> GetSQLValueString($HTTP_POST_VARS['LOGO'], "text"),

The problem is that the information you want is not stored in the
$_POST array but the $_FILES array. To get at the name of the file in
the file field you need to use $_FILES['LOGO']['name'] instead of
$_POST['LOGO']

--
Steve
steve at flyingtigerwebdesign dot com