5 Replies - 469 Views - Last Post: 20 April 2010 - 06:06 AM Rate Topic: -----

#1 aklo  Icon User is offline

  • D.I.C Head

Reputation: 18
  • View blog
  • Posts: 229
  • Joined: 23-January 09

About picture files.

Posted 19 April 2010 - 07:37 AM

What is the normal way to go about loading images name into the database?

Basically what i'm practicing now is files and uploading and deletion of files...as some of the users here, i'm using pokemon sprites in my practice site.

So i've already downloaded many images...now i need to get the names+extension into the database.

Looking through the php documentation, i believe to get the extension of the image file, i should use the filetype function but i just can't find how to get the filename.

Is This A Good Question/Topic? 0
  • +

Replies To: About picture files.

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6106
  • View blog
  • Posts: 23,653
  • Joined: 23-August 08

Re: About picture files.

Posted 19 April 2010 - 07:59 AM

insert into tablename (fieldname1, fieldname2, ..., fieldnameN) values (value_for_fieldname1, value_for_fieldname2, ..., value_for_fieldnameN)


Sounds like it's time for you to go read a SQL tutorial.
Was This Post Helpful? 0
  • +
  • -

#3 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1642
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: About picture files.

Posted 19 April 2010 - 08:19 AM

I wouldn't store your images in a database, for several reasons including degrading performance in your site and limiting your ability for any type of search feature on images. Store the images in the file system and only store data about the image (name, path, etc) in your database.
Was This Post Helpful? 0
  • +
  • -

#4 jrm402  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 51
  • View blog
  • Posts: 333
  • Joined: 18-March 10

Re: About picture files.

Posted 19 April 2010 - 03:59 PM

http://www.w3schools...file_upload.asp

That's a good website for uploading files with PHP. Since you will know the file name when you save it, just run an SQL query to store the filename to the database.
Was This Post Helpful? 0
  • +
  • -

#5 LiDoNg_9_0  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 159
  • Joined: 03-September 09

Re: About picture files.

Posted 19 April 2010 - 06:02 PM

y would you store your image in database? since your in a web based programming, it's really easy to embed medias.
try read about uploading files..
UPLOAD FILE TUTORIALS
Was This Post Helpful? 0
  • +
  • -

#6 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6106
  • View blog
  • Posts: 23,653
  • Joined: 23-August 08

Re: About picture files.

Posted 20 April 2010 - 06:06 AM

The OP is not looking to store the images in the database; he/she wants to do it the right way and store the path:

Quote

What is the normal way to go about loading images name into the database?

Emphasis mine.

Quote

i just can't find how to get the filename.

What do you mean about "getting the filename"? You can use pathinfo to get info about the file based on the path.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1