Can This be done with PHP?
I have a form that inserts Product data into the database, as well as one form that edits (updates) Products in the database.
at this address for example: “http://Localhost/shoppingcart/admin/addproduct.php”
Its working great. One of the fields in both forms is “Image”. The user types in the name of an image that has previously been uploaded to the hosting images directory via FTP. For example the user types: “TheProduct.jpg”
The whole FTP thing for the user is far to complicated so I want to make this easier.
- What I’m looking for is a field that will no allow the user to type into it.
- The user clicks onto a browse button next to the field.
- The user browses his/her own harddrive and finds the image they want. Example: C:folderdesktoptheproduct.jpg
- They select the image.
- Complete the rest of the form.
- Click submit.
The form will take the image selected and copy it to a folder onto the host machine:
for example: http://Localhost/shoppingcart/images/
The name of the image file is all that will be stored into the database. For example the image field it will only store “theproduct.jpg”
How can this be done in PHP.
Also second question:
I already know how to do this:
I already know know to make a file field in a form and upload an image to an upload folder directing in the same folder as the form folder. For example, what I mean is: If “uploadimage.php” is in the folder “http://localhost/imageuploadtesting/” … I know how to upload an image file to: “http://localhost/imageuploadtesting/test/uploads/” … but NOT outside of the “/test/” folder… I tried using things like $path = “…images/”; so that the file would upload to “/imageuploadtesting/images” … but it trys to upload to “http://localhost/imageuploadtesting/test/…images/” which is not there…
Anyways, thats my second question. I need help with the top one more.