Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

PHP, INSERT FILNAME FIELD FROM FORM

Explorer ,
Feb 21, 2007 Feb 21, 2007
I am trying to do a simple insert record into a MySQL database and for the life of me I cannot get the file field
(<input name="photoNAME" type="file" id="photoNAME" />)
to insert into the database. I have three other fields that do insert correctly the only one that won't go in is that field. I can't even get the form field to echo to the screen.

Anyone have any idea why?

Thanks
TOPICS
Server side applications
318
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 21, 2007 Feb 21, 2007
On Wed, 21 Feb 2007 13:49:43 +0000 (UTC), "VernMan"
<webforumsuser@macromedia.com> wrote:

>I am trying to do a simple insert record into a MySQL database and for the life
>of me I cannot get the file field
> (<input name="photoNAME" type="file" id="photoNAME" />)
> to insert into the database. I have three other fields that do insert
>correctly the only one that won't go in is that field. I can't even get the
>form field to echo to the screen.


See http://www.php.net/manual/en/features.file-upload.php

Gary
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 21, 2007 Feb 21, 2007
Gary White wrote:
> On Wed, 21 Feb 2007 13:49:43 +0000 (UTC), "VernMan"
> <webforumsuser@macromedia.com> wrote:
>
>> (<input name="photoNAME" type="file" id="photoNAME" />)


> See http://www.php.net/manual/en/features.file-upload.php

As Gary indicates, using type="file" is for file uploads. If all you're
trying to do is get the name of the file into a database, there's no
need to upload the file. In fact, it's a total waste of resources.

You need to use the PHP file system functions to build a list of the
images in your folder, and use it to populate a drop-down menu of
filenames. I show how to do it in both "Foundation PHP for Dreamweaver
8" and "PHP Solutions", but it's not all that difficult to code yourself
if you use scandir() (PHP 5 only).

--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 21, 2007 Feb 21, 2007
LATEST
On Wed, 21 Feb 2007 16:56:48 +0000, David Powers <david@example.com>
wrote:

>As Gary indicates, using type="file" is for file uploads. If all you're
>trying to do is get the name of the file into a database, there's no
>need to upload the file. In fact, it's a total waste of resources.

I was guessing that the next question would be what happened to the
file. ;-)

Gary
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines