mysql with php for upload download files to database
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
mysql with php for upload download files to database
Hi Friends,
I need some help on mysql database, I have installed RHEL-5.5 and in that mysql is running version 5...
i have created upload and download php scripts, i am able to upload and download files... but here i am not able to upload more than 1mb file size, i have changed values in /etc/php.ini file for post_max_size & post_max_size etc... even its not able to upload large files in that... I have increased value in php scrip also no effect...
here i am putting upload.php script, please let me know if i am doing any where mistakes...
Have you checked uploading files from phpmyadmin?
Are you facing same problem there too?
Quote:
Originally Posted by sandeepc04
i have changed values in /etc/php.ini file for post_max_size & post_max_size etc...
Did you mean upload_max_filesize & post_max_size? You must increase value of both parameters.
Did you restart apache after changing in php.ini.
Go to phpmyadmin and click on import, here it shows the max upload size of a file if it is still 1 mb it means you can not upload files more than 1 mb.
If you do not have phpmyadmin, try to upload files using linux terminal. If you can upload from linux terminal or phpmyadmin, it means there is a problem in your php script.
yes i can upload file from phpmyadmin, its showing that file upload size(Max: 768 kKiB) ...
how can i increase this size?
I have changed upload_max_filesize & post_max_size options in php.ini file then restarted server also, and i can upload and download files from php code which i have posted earlier post... but larger files i am not able to upload...
Thanks for your reply... no i am not finding any solution by that links...
At least this is possible like, I have data in /home/data/ this files i need to download by browser anywhere... so can i keep this files (.zip, .doc, .exe etc...) in database directly so that i can download by browser? (Like can connect this directory to database?)or would you suggest me any other way to access this data by browser without mysql?
Suppose webapp is your php-project directory. You can access this on your system using http://localhost/webapp
If you want to access this in same LAN, you use your LAN IP http://192.168.1.2/webapp
192.168.2.1 is your system's IP
but you can not access this side outside LAN. you need a static IP ( provided by Internet service provider)
Suppose your static IP is 112.26.54.118
Now you can access your site out side the LAN using http://112.26.54.118/webapp
Now if you want to download documents through browser.
Put the images, zip file, exe in the directory webapp with sufficient permissions.
Suppose There is a file app.exe in your webapp directory.
Now if you open http://112.26.54.118/webapp/app.exe, it downloads the file outside LAN.
Suppose webapp is your php-project directory. You can access this on your system using http://localhost/webapp
If you want to access this in same LAN, you use your LAN IP http://192.168.1.2/webapp
192.168.2.1 is your system's IP
but you can not access this side outside LAN. you need a static IP ( provided by Internet service provider)
Suppose your static IP is 112.26.54.118
Now you can access your site out side the LAN using http://112.26.54.118/webapp
Sorry, that's wrong. The IP address assigned by the ISP is for the ISP connection point, which does NOT go back to the internal LAN system. To do that, you need to either do port redirection in your router, or NAT the address somehow. And static IP's are not ALWAYS given by the ISP, only sometimes, depending on your provider/contract. Assuming you just get a static IP is not a good thing, since you may NOT get one, and may not even be ABLE to get one, depending on your provider.
Quote:
Now if you want to download documents through browser.
Put the images, zip file, exe in the directory webapp with sufficient permissions.
Suppose There is a file app.exe in your webapp directory.
Now if you open http://112.26.54.118/webapp/app.exe, it downloads the file outside LAN.
No, sorry, that's wrong, unless a few things happen first. Any files just shoved into that directory will NOT be visible through the web browser, unless you enable the Indexes option in Apache, or install another module to allow http/ftp file browsing. And with default indexing, if you just click a file, it will be executed/ran with whatever helper program is configured, or downloaded (in binary) to your browser if not. Unless you right-click and select "Save link as".
Quote:
I think 755 to directory webapp (Recursively) is sufficient to download files inside & outside LAN.
Yes, and it's also a huge security hole.
OP, if you want to upload files greater than 1 MB, you need to change the max_allowed_packet size. For example, to change it to allow files of up to 16MB, you'd enter:
Code:
SET GLOBAL max_allowed_packet=16*1024*1024;
...at the 'mysql>' prompt. Adjust the formula as needed. You may also need to adjust the max_allowed_packet option in the my.cnf file, such as:
Code:
max_allowed_packet=16M
...and restart MySQL afterwards. Check your mysql log file for errors when you try to upload files greater than 1MB.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.