Does anyone know any good tutorial on how to upload a file with php and save the files path to a sql server?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To upload a file you need at least a HTML POST form with
multipart/form-dataencoding. Therein you put aninput type="file"field to browse the file and a submit button to submit the form.In the
upload.phpthe uploaded file is accesible by$_FILESwith the field name as key.You can get its name as follows:
You need to move it to a permanent location using
move_uploaded_file(), else it will get lost:You can store the path in database the usual way: