473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 4839
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*******@attglobal.net
==================

Nov 30 '07 #3
On 11$B7n(B30$BF|(B, $B>e8a(B9$B;~(B19$BJ,(B, Jerry Stuckle <jstuck...@attglobal.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$BF|(B, $B>e8a(B9$B;~(B19$BJ,(B, Jerry Stuckle <jstuck...@attglobal.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$BF|(B, $B>e8a(B9$B;~(B19$BJ,(B, Jerry Stuckle <jstuck...@attglobal.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*******@attglobal.net
==================

Nov 30 '07 #6
On Fri, 30 Nov 2007 19:44:20 +0100, Jerry Stuckle
<js*******@attglobal.netwrote:
howa wrote:
>On 11月30日, 上午9時19分, Jerry Stuckle <jstuck...@attglobal.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#ini.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="multipart/form-data".
Nor is php://input or STDIN:
<http://nl2.php.net/manual/en/wrappers.php.php>
--
Rik Wasmus
Nov 30 '07 #7

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

Similar topics

31
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...
4
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...
10
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...
0
by: Mattia | last post by:
************************************************** Manage image without exhausted memory ************************************************** Hi; I have a big problem. I must create a script that...
2
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...
7
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...
3
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 ...
1
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...
3
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...

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.