473,549 Members | 3,109 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why I need to set the memory limit for large file upload?

Suppose the file is stored in "upload_tmp _dir ", so why I need to
increase the memory limit?

If I want to upload 100 MB, how large should I set?

Thanks.
Nov 29 '07 #1
6 4852
howa wrote:
Suppose the file is stored in "upload_tmp _dir ", so why I need to
increase the memory limit?

If I want to upload 100 MB, how large should I set?

Thanks.
Because all files are held in memory before being output to disk.
Nov 29 '07 #2
howa wrote:
Suppose the file is stored in "upload_tmp _dir ", so why I need to
increase the memory limit?

If I want to upload 100 MB, how large should I set?

Thanks.
You shouldn't have to increase the memory limit, but you'll probably
have to increase file upload size (in your webserver or html).

PHP doesn't get involved in the actual upload. Just after the upload
has completed. And moving the file doesn't require reading it into memory.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Nov 30 '07 #3
On 11$B7n(B30$B F|(B, $B>e8a(B9$B; ~(B19$BJ,(B, Jerry Stuckle <jstuck...@attg lobal.netwrote:
howa wrote:
Suppose the file is stored in "upload_tmp _dir ", so why I need to
increase the memory limit?
If I want to upload 100 MB, how large should I set?
Thanks.

You shouldn't have to increase the memory limit, but you'll probably
have to increase file upload size (in your webserver or html).
In the doc: http://us3.php.net/manual/en/feature...n-pitfalls.php

it said: if a memory limit is enabled, a larger memory_limit may be
needed. Make sure you set memory_limit large enough.

this is quite confusing, as it doesn't said how much you need to set
the memory limit

Thanks anyway.
howa
Nov 30 '07 #4
howa pisze:
On 11$B7n(B30$B F|(B, $B>e8a(B9$B; ~(B19$BJ,(B, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>howa wrote:
>>Suppose the file is stored in "upload_tmp _dir ", so why I need to
increase the memory limit?
If I want to upload 100 MB, how large should I set?
Thanks.
You shouldn't have to increase the memory limit, but you'll probably
have to increase file upload size (in your webserver or html).

In the doc: http://us3.php.net/manual/en/feature...n-pitfalls.php

it said: if a memory limit is enabled, a larger memory_limit may be
needed. Make sure you set memory_limit large enough.

this is quite confusing, as it doesn't said how much you need to set
the memory limit

depends on your config

for example
if you have "always poputale raw post data" enabled you need enough to
fit "raw post data" to one of the variables.

--
Piotr Siudak
Nov 30 '07 #5
howa wrote:
On 11$B7n(B30$B F|(B, $B>e8a(B9$B; ~(B19$BJ,(B, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>howa wrote:
>>Suppose the file is stored in "upload_tmp _dir ", so why I need to
increase the memory limit?
If I want to upload 100 MB, how large should I set?
Thanks.
You shouldn't have to increase the memory limit, but you'll probably
have to increase file upload size (in your webserver or html).

In the doc: http://us3.php.net/manual/en/feature...n-pitfalls.php

it said: if a memory limit is enabled, a larger memory_limit may be
needed. Make sure you set memory_limit large enough.

this is quite confusing, as it doesn't said how much you need to set
the memory limit

Thanks anyway.
howa
Quite frankly, I don't know. The file itself isn't posted; it comes in
a separate request. And AFAIK, the server handles the upload into the
temporary directory. Even if it doesn't, I wouldn't expect PHP to read
the entire file in before saving it.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Nov 30 '07 #6
On Fri, 30 Nov 2007 19:44:20 +0100, Jerry Stuckle
<js*******@attg lobal.netwrote:
howa wrote:
>On 11月30日, 上午9時19分 , Jerry Stuckle <jstuck...@attg lobal.netwrote:
>>howa wrote:
Suppose the file is stored in "upload_tmp _dir ", so why I need to
increase the memory limit?
If I want to upload 100 MB, how large should I set?
Thanks.
You shouldn't have to increase the memory limit, but you'll probably
have to increase file upload size (in your webserver or html).

In the doc:
http://us3.php.net/manual/en/feature...n-pitfalls.php

it said: if a memory limit is enabled, a larger memory_limit may be
needed. Make sure you set memory_limit large enough.

this is quite confusing, as it doesn't said how much you need to set
the memory limit

Thanks anyway.
howa

Quite frankly, I don't know. The file itself isn't posted; it comes in
a separate request. And AFAIK, the server handles the upload into the
temporary directory. Even if it doesn't, I wouldn't expect PHP to read
the entire file in before saving it.
Indeed. The mentioned 'raw post data' is also not populated with HTTP
file-uploads:
<http://nl2.php.net/manual/en/ini.core.php#in i.always-populate-raw-post-data>
"Always populate the $HTTP_RAW_POST_ DATA containing the raw POST data.
Otherwise, the variable is populated only with unrecognized MIME type of
the data. However, the preferred method for accessing the raw POST data is
php://input. $HTTP_RAW_POST_ DATA is not available with
enctype="multip art/form-data".
Nor is php://input or STDIN:
<http://nl2.php.net/manual/en/wrappers.php.ph p>
--
Rik Wasmus
Nov 30 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

31
9776
by: lawrence | last post by:
I'm not sure how this is normally done, on a large site, perhaps one running Phorum. Occassionally a thread will have hundreds of entries, perhaps a meg or two worth of data. You won't necessarily print all that to the screen, but PHP has to hold it in memory. Run some operations on it, or, more likely, have an array that you keep adding...
4
2904
by: Tihon | last post by:
Hello! I again need your help, just can't understand whats going on. Got this upload pictures form and it's having problem handling large files (~1.5 - 2 MB). Everything works fine if i just upload files, like this: copy ($myfile, $uploadfolder . "/" . $myfile_name); Everything works fine, it can process large files and everything, but...
10
3784
by: VM | last post by:
How can I limit the use of the PC's virtual memory? I'm running a process that basically takes a txt file and loads it to a datatable. The problem is that the file is over 400,000 lines long (77 MB) and after a while I get the Windows message saying that the virtual memory's getting really low. Plus the machine gets really sluggish (with...
0
1896
by: Mattia | last post by:
************************************************** Manage image without exhausted memory ************************************************** Hi; I have a big problem. I must create a script that upload an image an then resize it, if width or height are more than 250px. Now, after upload an image (in this example I suppose that it's a JPEG...
2
552
by: lawrence k | last post by:
I've a file upload script on my site. I just now used it to upload a small text document (10k). Everything worked fine. Then I tried to upload a 5.3 meg Quicktime video. Didn't work. I've set the POST limit in php.ini to 8 megs. What reasons, other than the POST limit, would a large upload fail?
7
4026
by: HeatherS | last post by:
We are having issues with our windows services using memory and never releasing it. We have one service that has a file watcher which takes an xml file, inserts some records into a database, and creates a bunch of PDFs with Crystal Reports. Another service is a remote object which serves as our data access component -- basically it just...
3
13122
by: Jefferis NoSpamme | last post by:
Hello all, I'm trying to limit the file size to 1 meg on upload of image files and I am trying a script from javascript internet, but it is giving me errors on IE is null or not an object and isnt checking the file size or preventing the upload. ERROR IS <<<<this.form.uploadfile.value is null or not an object on this line:
1
9296
by: DBC User | last post by:
Hi, I am using MTOM and WSE 2.0 and trying to upload a file which is almost 70MB (big). I have setup the timeout to a good size and file size limit to 100MB in the server. The uploading is coming through T3 pipe. Even with all the changes, I get a 'out of memory' error. Can someone help? In my code, I am reading the file into a byte...
3
2186
by: Milagro | last post by:
Hello Everyone, I'm trying to debug someone elses php code. I'm actually a Perl programmer, with OO experience, but not in php. The code is supposed to upload a photo from a form and save it both on the file system and in a mySql database. 90% of the time it works just fine. But for some reason, with some photos, it doesn't work. The...
0
7446
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7718
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7470
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7809
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3498
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3480
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1936
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1058
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.