Roopavathy Posted January 17, 2014 Share Posted January 17, 2014 Hello there, I want to use the file type field to browse a pdf or word document in my registration form.I dont know how to use it. Please help me. I have followed the following example.But dont know how to upload a pdf or word document. http://www.w3schools.com/php/php_file_upload.asp Quote Link to comment Share on other sites More sharing options...
KaiSheng Posted January 17, 2014 Share Posted January 17, 2014 I do not understand what u mean by browse your document in your registration form. if you want to upload something up to your database, that can be done in a minute. Quote Link to comment Share on other sites More sharing options...
Roopavathy Posted January 17, 2014 Author Share Posted January 17, 2014 I mean Uploading a document file or a pdf file. Quote Link to comment Share on other sites More sharing options...
Solution KaiSheng Posted January 17, 2014 Solution Share Posted January 17, 2014 First you need to create a form in php. Second, you need to pass the values you gotten from the form into your database. I'll show you an example. This is your form. <form method="post" action="xxx.php" enctype="multipart/form-data"> <tr> <td><label for="file">File name:*</label></td> <td> <input type="file" name="file" required> </td> </tr> --- This will be the second page where the value is passed. move_uploaded_file($_FILES["file"]["tmp_name"], "doc/" . $_FILES["file"]["name"]); the above code, "doc" represents the name of the folder. the "file" represent the value from the form, in which the file that you are uploading. the "tmp_name" represents the temporary file name stored in the server. the "name" is the attributes of the file you uploaded. This is the simplest. I did not include any database connection, presume you already know how to, and youtube have lots of tutorials for this. You can take a look at this. Quote Link to comment Share on other sites More sharing options...
Roopavathy Posted January 17, 2014 Author Share Posted January 17, 2014 Thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.