How is everyone. Thanks for having such a site.
I am new to PHP but am having a good time learning, with alot of success in my opinion. I created a succesfully mysql DB and I made it so I can use HTML forms to add records to the DB. That all works.
However, I want to be able to upload an image. I know there is an upload image script. However, if the user adds a record to the database, the image will get lost in my server with its random filename. How can I keep it together? In other words, is there anyway I can have the user upload the image first, then determine where that image is located, then add that location as an element in the record? That way the location of the image would be in the database as a column.
Any suggestions are appreciated.
Thanks,
Rob.
Keeping it all together!
Moderator: General Moderators
Thanks for the reply. I see what you mean, I was trying to avoid having memberships but I suppose that is the best alternative. For authentication, I can just have a seperate DB that has all the usernames a passwords? And then when the user submits their login info I just check it against whats in the DB?
But I'm a bit confused what I do once the user is authenticated. Say I have a table with the users, as you suggested:
USERNAME PASSWORD ID#
I don't understand how I incorporate that with the table I already have, that looks like this (called FileInfo)
FILE AUTHOR COMMENT COPYRIGHT
Sorry if that's confusing. But see it's almost as if I would need a table called FileInfo per user. But that wouldn't make sense though.
Thanks again,
Rob.
But I'm a bit confused what I do once the user is authenticated. Say I have a table with the users, as you suggested:
USERNAME PASSWORD ID#
I don't understand how I incorporate that with the table I already have, that looks like this (called FileInfo)
FILE AUTHOR COMMENT COPYRIGHT
Sorry if that's confusing. But see it's almost as if I would need a table called FileInfo per user. But that wouldn't make sense though.
Thanks again,
Rob.
Ok so I have two tables then:
Username or Personal ID | Password
User logs in. Is verified by that database. Maybe a welcome screen such as "Welcome " username.
The user decides to upload a picture. The database that will hold all the pictures will look like this:
File | Username or Personal ID | Comment | Copyright
someFile.jpg someUniqueUser This is a comment Copyright
And then each time the user logs on it will just use a SELECT query to display ONLY the pictures that THAT user has uploaded.
I think that might work, what do you think?
However the ONLY problem would be the "File" field. I don't know how I would determine where it is locatedon the server since its an obscure filename like hjfuh3ufh3pfhw3pfwu34243.jpg
Thanks for helping a beginner
Username or Personal ID | Password
User logs in. Is verified by that database. Maybe a welcome screen such as "Welcome " username.
The user decides to upload a picture. The database that will hold all the pictures will look like this:
File | Username or Personal ID | Comment | Copyright
someFile.jpg someUniqueUser This is a comment Copyright
And then each time the user logs on it will just use a SELECT query to display ONLY the pictures that THAT user has uploaded.
I think that might work, what do you think?
However the ONLY problem would be the "File" field. I don't know how I would determine where it is locatedon the server since its an obscure filename like hjfuh3ufh3pfhw3pfwu34243.jpg
Thanks for helping a beginner