Uploading files into a MySQL database using PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dignat
    New Member
    • Aug 2011
    • 3

    Hello Atli,
    I used your code and everuthing is fine but I can not read word files properly when download them and pdfs are corrupt.
    Cabn you help me , i used headers, but it is not working

    Comment

    • dignat
      New Member
      • Aug 2011
      • 3

      hi atli,
      i used your code, but i can not read properly msword document after dwnloading it.

      Comment

      • pavanipuppy
        New Member
        • Oct 2011
        • 1

        hey hi..am new to this php stuff...so please help me..u have some .php files here...how should i compile or execute dis code??? is it automatically executed when it is called in .html page?? and how to make database connections for a .html file?? thanku in advance..

        Comment

        • Dormilich
          Recognized Expert Expert
          • Aug 2008
          • 8694

          PHP code is neither compiled nor executed. it is automatically processed on a server with PHP installed (given the server is correctly configured). which also means that it doesn’t do anything in a .html page.

          Comment

          • shakhawat
            New Member
            • Oct 2011
            • 4

            when i download file using php script message will be shown:
            Object not found!

            The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

            If you think this is a server error, please contact the webmaster.
            Error 404
            localhost
            10/31/11 09:29:10
            Apache/2.2.2 (Win32) DAV/2 mod_ssl/2.2.2 OpenSSL/0.9.8b mod_autoindex_c olor PHP/5.1.4

            Comment

            • jennifersolomon
              New Member
              • Nov 2011
              • 1

              Hi

              you code works perfect for single file
              but how do i modify it to select multiple files and upload it to the server

              Thanks

              Comment

              • arashi23
                New Member
                • Nov 2011
                • 2

                Hello~ I used your codes for self-practice and I encountered a problem when using this code. I was given this warning:

                Warning: mysqli::mysqli( ) [mysqli.mysqli]: (42000/1049): Unknown database 'file' in C:\xampp\htdocs \test5\add_file .php on line 7
                MySQL connection failed: Unknown database 'file'

                Line 7 of the code:
                Code:
                $dbLink = new mysqli('localhost', '***', '***', 'file');
                I've used the exact same codes as you've posted, the only difference is the user and password for the database. I've already created the 'file' table in my database though, so I'm not sure what was wrong. I'm using php 5.3.8 & MySQL 5.5.16

                Maybe the problem lies with me using MySQL instead of MySQLi? Since the codes use MySQLi. Any help or pointers would be much appreciated since I'm really new to this PHP and MySQL thing. ^_^

                Comment

                • Dormilich
                  Recognized Expert Expert
                  • Aug 2008
                  • 8694

                  the fourth parameter is the name of the database on the database server, not that of a table in a database.

                  Comment

                  • arashi23
                    New Member
                    • Nov 2011
                    • 2

                    Oh! Thank you for pointing that out. ^^'

                    Comment

                    • xyzravi
                      New Member
                      • Nov 2011
                      • 4

                      I have used the code of 'Atli' posted on Nov, 23 2007 to upload the images into the mysql database and it's working fine but i need some more help that is..

                      how to display image on browser that is stored in mysql database using php code?

                      Thanks.

                      Comment

                      • yogesh131
                        New Member
                        • Dec 2011
                        • 1

                        hello ..
                        this is superb...
                        can you tell me how to delete a file and send through mail
                        thanks

                        Comment

                        • abelcher
                          New Member
                          • Jan 2012
                          • 1

                          Hello,
                          i am using your code for uploading resumes to a database but i need to do a join to like them together. i was wondering if i could get some help on this.
                          this is my code to link them

                          Code:
                          $qr =  "SELECT job_seeker_info.id, job_resume.id ".
                           "FROM job_seeker_info, job_resume ".
                          	"WHERE job_seeker_info.id = job_resume.id, and job_seeker_info.uname = '".$_SESSION['uname']."'"  ;
                          how can i get the correct id to show on the page for the link?

                          Comment

                          • zaza77
                            New Member
                            • Mar 2012
                            • 1

                            there is the error occur after uploading the files..


                            Warning: mysqli::mysqli( ) [mysqli.mysqli]: (28000/1045): Access denied for user 'user'@'localho st' (using password: YES) in C:\xampp\htdocs \project open office easy learning\add_fi le.php on line 7
                            MySQL connection failed: Access denied for user 'user'@'localho st' (using password: YES)

                            Comment

                            • aziz123
                              New Member
                              • Mar 2012
                              • 9

                              Hi Atli's,

                              Great tutorial just wondering could it be possible to demonstrate how to delete files within the list_files.php as I have tried and Dormilich has help me but still could not understand what I am doing wrong.

                              As I have stated in my post I am a self learning PHP and MYSQL and would love to see a guide from you on this so that I can learn from it and compare my code as well.

                              thanks

                              Comment

                              • sachin8289
                                New Member
                                • Apr 2012
                                • 1

                                used same code as above but got error as below

                                Error! Failed to insert the file

                                Got a packet bigger than 'max_allowed_pa cket' bytes

                                how to get rid of this problem, i ma trying to upload 7mb single file

                                Comment

                                Working...