I’m trying to figure out how to upload imaged to a folder. I don’t want to list it by listing all files in the directory.
What I want to do is have the user insert certain values to put into the MySQL, then take the file name when the file is finished uploading and insert it into a MySQL field “filename”.
Thing is, I don’t really know how to do file uploads in PHP, much less how to have it not add the information to the database until the file is fully uploaded. Could someone please help me out?
I also wanted to know how I could limit the max filesize to a certain size. I haven’t been following technology for a while, so I wanted to know what the average size of an image would be of a photo take with an average digital camera now of days?
Well you seem to have broken it down into the steps yourself so you seem to understand what to do.
The first thing you need is to upload the file in PHP. You can find a tutorial on it here. You will need a form in HTML and a PHP file which will handle it. This is also where you specify the file size.
Sample HTML
Sample PHP
Then once you have uploaded the file you will need to store it in your database. You need to connect to your database (tutorial here)
Then you will need to add the information to the table, the filename is in the var
$_FILES['uploadedfile']['name']so you would need some code along the lines ofMore information on inserting into a database can be found here