Solved

PHP upload files of up to 50MB

Posted on 2010-09-23
23
739 Views
Last Modified: 2012-05-10
Hi

I have hosting on a shared windows server.

I want to be able to let my clients upload large (ish) files to my server for me to work on...

I am unable to access the php.ini file to change the max file size settings so I am looking for an alternative that will allow me to upload files in the region of 50MB...

Anyone know of a workaround for this problem? FREE solution would be good!

Thanks

CD
0
Comment
Question by:cycledude
  • 11
  • 6
  • 6
23 Comments
 
LVL 9

Accepted Solution

by:
crazedsanity earned 400 total points
ID: 33744155
It is a per-directory configuration, so you should be able to put it in a ".htaccess" file (assuming the server is running Apache), in the form:

php_value upload_max_filesize 50M

For more information, take a look at the PHP page about it, as you will probably also need to look at the directive for post_max_size.  

DIRECTIVES PAGE: http://us.php.net/manual/en/ini.core.php#ini.upload-max-filesize 
CONFIG CHANGES: http://php.net/manual/en/configuration.changes.php

Let me know if you need more information.
0
 

Author Comment

by:cycledude
ID: 33744610
Hi crazedsanity
Thanks for the feedback...  How do I find out (without asking the host) if it is running apache?
Cheers
 
 
0
 
LVL 9

Expert Comment

by:crazedsanity
ID: 33744825
Create a PHP file and put "phpinfo()" in it.  That will output pretty much everything you need to know (and probably a lot more): it should have lots of references to "apache" or "apache2".
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:cycledude
ID: 33744899
Hi again
I already tried that and it doesn't mention apache...  oh dear!
 
0
 
LVL 9

Expert Comment

by:crazedsanity
ID: 33745223
From what I've found with PHP running on Windows without Apache, it seems there may be little choice.  The only way I could potentially help you any further would be to give me a link to the info page or save it & attach as a file.  Sorry.
0
 
LVL 3

Assisted Solution

by:Progressed
Progressed earned 100 total points
ID: 33745392
no worries... just use uploadify! its a flash uploader and its uploads a file on the fly!

Youll get a nice upload status with it!

www.uploadify.com
0
 

Author Comment

by:cycledude
ID: 33745790
@progressed
Thats a nice upload utlilty, however it crashes at the same point as a normal file upload, due to the server not allowing over xMB
@crazedinsanity
See attached phpinfo

test.php.htm
0
 
LVL 9

Expert Comment

by:crazedsanity
ID: 33746202
It looks like the server is setup to use FastCGI on IIS 6.0.  You can attempt to put your own php.ini file in your "wwwroot" directory to see if that will override the default, but it looks like the server won't allow it (the "wwwroot" folder isn't in the path).

There is some good information about your setup here: http://www.php.net/manual/en/install.windows.iis6.php
0
 
LVL 3

Expert Comment

by:Progressed
ID: 33752333
Dont change default settings of your php.ini! its not set by default for nothing!

make a new file or add the following line to your .htaccess file:

php_value memory_limit 60M

This wel set the uploadlimit of ONLY this website to 60M.
0
 
LVL 3

Expert Comment

by:Progressed
ID: 33752395
offcourse i ment:

php_value upload_max_filesize 60M
php_value max_execution_time 1000

while your at it... the executiontime must be longer then default... duhh!
0
 

Author Comment

by:cycledude
ID: 33754353
@progressed
I already tried adding a .htaccess file with the following
php_value upload_max_filesize 100M
php_value max_execution_time 800
php_value post_max_size 100M
php_value max_input_time 100
php_value memory_limit 120M
 
but it did not work...
0
 
LVL 3

Expert Comment

by:Progressed
ID: 33754380
well it should...
0
 
LVL 9

Expert Comment

by:crazedsanity
ID: 33754414
@Progressed: the ".htaccess" solution is only applicable when the server is Apache.  This server is running PHP in FastCGI form on IIS/6.0.

@cycledude: did you try copying the php.ini to your public (wwwroot) folder and setting the values there?  HINT: after changing values, make sure to reload the page with the phpinfo() in it, see what INI file/values are there.
0
 

Author Comment

by:cycledude
ID: 33754460
@crazedsanity
I don't know where to locat the php.info file, I have never seen it?
 
 
0
 

Author Comment

by:cycledude
ID: 33754466
sorry i mean php.ini
 
0
 

Author Comment

by:cycledude
ID: 33754685
I just asked my host the same question and the response was:
"Not on Windows hosting I'm afraid.

It's a global php.ini"

Doh!
 

 
 
0
 
LVL 9

Expert Comment

by:crazedsanity
ID: 33755062
Unfortunately, it seems that you may not have any options here.  The host has all the control here, so you may have to somehow get them to update your upload_max_filesize setting, which probably has to be done in your website's configuration.
0
 

Author Comment

by:cycledude
ID: 33767639
Hi... Thanks for all the help
I guess it a 'change host' situation... although I would be grieved to do so as they have have been great...
I could use something like this, which allows you to upload massive files without any server side configuration
http://www.aspupload.com/
Is there a php alternative to this?
I could use ASP, it would not be a problem....
0
 

Author Comment

by:cycledude
ID: 33767643
Oh yeah, if there was a 'free' alternative it would be great!
 
0
 
LVL 3

Expert Comment

by:Progressed
ID: 33767663
welllll... lookie here! did the fileuploading stop around 30Mb?

Heres why!

to the MediaWiki LocalSettings.php configuration file for each wiki. In this example the PHP limit is set at 50 Mb. Note that these settings will not override the maximum settings set above (since the core php.ini and apache2 php.ini files set the absolute maximum). This method sets maximums that are less than the absolute maximum.

 Note: IIS7 Users. By default, IIS7 on Windows 2008 allows only 30MB to be uploaded via a web application. Larger files will return a 404 error after the upload. If you have this problem, you can solve it by increasing the maximum file size by adding the following code to <system.webServer> in the web.config file:

<security>
  <requestFiltering>
    <requestLimits maxAllowedContentLength=”50000000¿ />
  </requestFiltering>
</security>
With the above maxAllowedContentLength, users can upload files that are 50,000,000 bytes (50 MB) in size. This setting will work immediately without restarting IIS services. The web.config file is located in the root directory of your web site.
0
 

Author Comment

by:cycledude
ID: 33768552
@progressed
Hi Mate, the server I am on is iis6 and I am using php, although asp could be used, indeed even asp.net ....
But what you are referring to I believe is related to iis7, which I don't have access to.
Thanks for looking though.
 
0
 

Author Closing Comment

by:cycledude
ID: 33776448
Hello fellas

Well it looks like I have come full circle on this, and it looks like I am not going to be able to achieve the upload of large files without buying a 3rd part com object.

Thanks for the advice, I have awarded points to both experts but 80% goes to crazedsanity as he offered most advice.

Thanks

CD
0
 
LVL 3

Expert Comment

by:Progressed
ID: 33776469
too bad... well glad to be of assistance anyway!

Danny
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question