Add large number of images to drupal site I am trying to create an image gallery in my drupal site from the backend. Also I want to add images to existing content types since there are large number of nodes and attaching image to each of them from the front end is not feasible. What I have understood follows here:

The database contains the table named files that consists of path and type of each file uploaded from fronted. The fid corresponding to each of these paths is used in corresponding content type table to produce images at required node.

Plase tell me if this approach is wrong:

I wanted to upload images in bulk and add image names and there path in the files table as well as corresponding fid's in the content type tables.

But this does not work. Can someone help me with this. Have I analysed it wrongly?
I spent some time in understanding how Drupal 6 retrieves images to show on front-end. Since drupal is heavily database intensive, all the files and images are retrieved from the database itself. 

If you are using CCK in your site, you must have created image fields for some content types. Now if you open the database and check the table for respective content type, you will find that there are three columns created for each image cck field namely field_name_fid,field_name_list,field_name_data . 

The field "field_name_fid" is the key field that maps images to this content type. The fid is the key that is matched to the fid of the table "files". If you open this table, you will find that the primary key of this table i.e fid is used to map images throughout Drupal content.

Here comes the solution


Upload an image from the frontend to test where is your file saved
physically in you drupal directory. For every image uploaded to any
node from front-end there will be an entry in the files table with
its filename, filepath, filemime, file size, status and timestamp.
The fields that you should take care about in the files table are filename, uid, filepath, filemime, and status.  
All you have to do is, Place all your files in that physical location.
Run SQL queries to first fill all the fields stated in #2. and match the fid of files table to the field_name_fid of respective content type.


And you are done.