MarkT Posted December 17, 2013 Share Posted December 17, 2013 Hello, Can anyone show me a demo of a code, I'm looking for a form that uses text and file upload. I need a form that has details such as title and content, but I also want an image upload where it saves the file to my FTP server in a folder called Uploads and then it saves the filename and extension to the database, along with the other details from the form. Can anyone give me the code and explain it please! Thanks in advance. Link to comment Share on other sites More sharing options...
Ingolme Posted December 18, 2013 Share Posted December 18, 2013 You should read the tutorials about databases and file uploading: http://w3schools.com/php/php_mysql_intro.asp http://w3schools.com/php/php_file_upload.asp Link to comment Share on other sites More sharing options...
MarkT Posted December 18, 2013 Author Share Posted December 18, 2013 I've tried, but the file upload script is confusing me, Can you explain it please? Where to put details/upload directory etc. Link to comment Share on other sites More sharing options...
justsomeguy Posted December 18, 2013 Share Posted December 18, 2013 The "Saving the Uploaded File" example shows how to save the file. You use the move_uploaded_file function to save it where you want. As for the other fields in the form, those are just normal form fields that will have their values submitted via $_POST. http://www.php.net/manual/en/function.move-uploaded-file.php Link to comment Share on other sites More sharing options...
MarkT Posted December 20, 2013 Author Share Posted December 20, 2013 Alright, I get the code. But how do I set my SQL query to save the filename in the database? Link to comment Share on other sites More sharing options...
justsomeguy Posted December 20, 2013 Share Posted December 20, 2013 I'm not sure which part you're missing. If you have the filename, then just add it to the query the same way you would add any other string. Have you worked with databases before? Link to comment Share on other sites More sharing options...
MarkT Posted December 21, 2013 Author Share Posted December 21, 2013 Yeh, Just never File Upload.... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now