Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 31st, 2010, 03:34 PM
Registered User
 
Join Date: Mar 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Upload script with images with a file size greater than 20 MB.

Hello everyone.

I'm looking for a book in PHP and MySQL, which are examples of an upload script with images with a file size greater than 20 MB. The script must be able to write the image and create thumbnails and put it into another folder. Example: images (large files) and (thumbs small files).
I know the script from your book: Beginning PHP5, Apache and MySQL Web Development, but the script makes mistakes when the file size is too big. (There are not created thumbnails.) Otherwise it works perfectly.
I want to create a picture gallery, where people are able to upload their photos from their digital camera. These files may have a file size greater than 20 MB.
Can anyone help me?

Jens
 
Old March 31st, 2010, 09:16 PM
Friend of Wrox
 
Join Date: Dec 2008
Posts: 238
Thanks: 2
Thanked 20 Times in 19 Posts
Default

Go through your php.ini, find those settings, and make the changes:

Code:
post_max_size = 30M 
; or some other number that's bigger than 20M
upload_max_filesize = 30M
; or some other number that's bigger than 20M
memory_limit = 128M
; this is the default for me, make sure it's big enough
max_input_time = -1
; -1 is unlimited, or set as needed
At the beginning of your script, add this line:

Code:
set_time_limit(0);
 
Old April 2nd, 2010, 02:29 PM
Registered User
 
Join Date: Mar 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks PeterPeiGuo for your answer, but it's not exactly what I need. I must do and know the code for such a script. I can refer to link: http://phpfileuploader.com/demo/form-simple-upload.php or something else.
Hope I can find help here.

All the best

Jens
 
Old April 3rd, 2010, 04:29 PM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

What Peter means is that this is the only difference between a standard PHP upload script and one which allows you to upload "mega" files. The PHP code for uploading files of any type and size is identical. The problem with large files is that the server won't allow it. Peter responded with the configuration settings in PHP (and there may be some Apache settings, I don't know) that you need to switch. This is why I hate server administration. Yuck.

That said, be REALLY sure that you need to upload files of this size. The reason servers don't let you do this normally is that it's a bad idea to give your users this power. If you do, expect high server loads. Depending on your package, your webhost may require that you buy a more expensive package, or they may charge you very high fees for exceeding your bandwidth. At the very least, consider if there are some roles which should have access to mega-uploads and others that should not. That will give you at least a minimal level of control.
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.





Similar Threads
Thread Thread Starter Forum Replies Last Post
ch.2- cant upload a file no bigger than 52 MB?? cluce BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 5 April 30th, 2008 09:08 AM
Uplad txt field of size greater than 12 mb rapraj PHP Databases 3 October 28th, 2007 09:36 AM
Upload .txt file of size 15 mb or more rapraj PHP Databases 1 October 24th, 2007 06:34 PM
Upload Files of Greater Size (>5Mb) saravananedu ASP.NET 1.0 and 1.1 Basics 1 May 4th, 2005 12:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.