pretty new to this so be gentle...
I'm trying to build a gallery site with a LAMP set up. (steep learning curve but having lots of fun).
Users upload images to their own directories and the filepath to the image is stored on the db.
I've got this 99% working except for one glaring problem.
If I (as member 1) upload an image it's placed my images dir and renamed "1.jpg"
If I (as member 2) do the same thing I get this error: Duplicate entry '1.jpg' for key 2
I'm pretty sure this is to do with the foreign key and I'd really appreciate some newb style advice on what
I'm doing wrong and how (if) I can fix it.
OK this is how the db is set up: (pictures speak loudest)...
Made a table "myMembers" to hold the basics on members.

Made a table "pictures" with UID as the unique and created an index on this of "images:member_fk".

Tried to link the UID field of "pictures" to the "id" field of "myMembers" I'm presented with four drop downs.
If I set the first to "myMembers-> id" and the last to to "CASCADE" when I hit "GO" the page refreshes and the cascade is not set.
If I set the first to "myMembers-> id" and the second to "pictures -> UID" the cascade IS set but I still get the same error
of Duplicate entry '1.jpg' for key 2 if I try to upload an image.

Some advice on this would be very welcome as I've spent all day reading and trying to solve it with no joy.
I'm happy to start from scratch if that's what's needed but I have to get it solved !
Best wishes
Monty