# [PATCH][HEAD] Upload progress in sessions

- Thread: https://externals.io/message/40332
- Original archive: https://news-web.php.net/php.internals/40332
- Started by Arnaud Le Blanc on 2008-09-08T10:18:02+00:00
- Messages: 7
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #40332 — Arnaud Le Blanc — 2008-09-08T10:18:02+00:00

URL: https://externals.io/message/40332#40332

Hi,

I have written a patch to implement upload progress feedback in session data.

The file upload feature in PHP allows extensions to be called back on some 
events. A few extensions use this to implement some sort of upload progress 
feedback, but none of them are released with PHP, which makes this feature 
unusable in many environments.

The patch allows to store upload progress informations in session variables. 
These informations can be retrieved by an other script while the upload is 
still in progress, allowing to provide feedback to the user.
Implementing this in the sessions extension makes this feature available to 
every one.
Using the session extension for this purpose also allows to use the different 
storage backends available.
I have written a RFC/documentation here:
http://wiki.php.net/rfc/session_upload_progress

Any objection on committing this to HEAD ?

Regards,

Arnaud

---

## #40336 — Pierre Joye — 2008-09-08T11:03:11+00:00

URL: https://externals.io/message/40332#40336 · In reply to: #40332

> Hi,
>
> I have written a patch to implement upload progress feedback in session data.
>
> The file upload feature in PHP allows extensions to be called back on some
> events. A few extensions use this to implement some sort of upload progress
> feedback, but none of them are released with PHP, which makes this feature
> unusable in many environments.
>
> The patch allows to store upload progress informations in session variables.
> These informations can be retrieved by an other script while the upload is
> still in progress, allowing to provide feedback to the user.
> Implementing this in the sessions extension makes this feature available to
> every one.
> Using the session extension for this purpose also allows to use the different
> storage backends available.
> I have written a RFC/documentation here:
> http://wiki.php.net/rfc/session_upload_progress
>
> Any objection on committing this to HEAD ?

It is indeed nice to have this feature without relying on an
extension, however do you know that APC will be bundled in php6? As
APC provides this feature.

Cheers,
-- 
Pierre
http://blog.thepimp.net | http://www.libgd.org

---

## #40337 — Martin Jansen — 2008-09-08T11:06:50+00:00

URL: https://externals.io/message/40332#40337 · In reply to: #40332

> The patch allows to store upload progress informations in session variables.
> These informations can be retrieved by an other script while the upload is
> still in progress, allowing to provide feedback to the user.
> Implementing this in the sessions extension makes this feature available to
> every one.
> Using the session extension for this purpose also allows to use the different
> storage backends available.
> I have written a RFC/documentation here:
> http://wiki.php.net/rfc/session_upload_progress

Would it be possible to use something like
$_SESSION['foo']['upload_progress_123'] instead of storing the
information in the top-level session space?  I can imagine there being
frameworks and such that put their session stuff in some special
container like $_SESSION['foo'] so that their session data does not
interfere with the data of other components or the application that
makes use of the framework.

Martin

---

## #40338 — Arnaud Le Blanc — 2008-09-08T11:15:31+00:00

URL: https://externals.io/message/40332#40338 · In reply to: #40336

Hi,

On Monday 08 September 2008 13:03:11 Pierre Joye wrote:
> On Mon, Sep 8, 2008 at 12:18 PM, Arnaud Le Blanc <arnaud.lb@gmail.com> 
wrote:
> > […]
data.
> > […]
progress
> > […]
variables.
> > […]
to
> > […]
different
> > […]
> 
> It is indeed nice to have this feature without relying on an
> extension, however do you know that APC will be bundled in php6? As
> APC provides this feature.

Yes, but I don't think it will be enabled on shared hosting, for instance.

Also, while session data can be shared across multiple servers, APC's storage 
can't.

> 
> Cheers,
> -- 
> Pierre
> http://blog.thepimp.net | http://www.libgd.org
> 

Regards,

Arnaud

---

## #40339 — Arnaud Le Blanc — 2008-09-08T11:19:53+00:00

URL: https://externals.io/message/40332#40339 · In reply to: #40337

Hi,

On Monday 08 September 2008 13:06:50 Martin Jansen wrote:
> On Mon, Sep 8, 2008 at 12:18 PM, Arnaud Le Blanc <arnaud.lb@gmail.com> 
wrote:
> > […]
variables.
> > […]
to
> > […]
different
> > […]
> 
> Would it be possible to use something like
> $_SESSION['foo']['upload_progress_123'] instead of storing the
> information in the top-level session space?  I can imagine there being
> frameworks and such that put their session stuff in some special
> container like $_SESSION['foo'] so that their session data does not
> interfere with the data of other components or the application that
> makes use of the framework.

Yes, this can be done. The prefix setting ("upload_progress_" by default) was 
added for that purpose, but it may be possible to use $_SESSION[prefix][name].

> 
> Martin
> 

Regards,

Arnaud

---

## #40342 — Richard Quadling — 2008-09-08T13:19:07+00:00

URL: https://externals.io/message/40332#40342 · In reply to: #40339

2008/9/8 Arnaud Le Blanc <arnaud.lb@gmail.com>:
> Hi,
>
> On Monday 08 September 2008 13:06:50 Martin Jansen wrote:
> > […]
> wrote:
> > […]
> variables.
> > […]
> to
> > […]
> different
> > […]
>
> Yes, this can be done. The prefix setting ("upload_progress_" by default) was
> added for that purpose, but it may be possible to use $_SESSION[prefix][name].
>
> > […]
>
> Regards,
>
> Arnaud
>
> --
> 
> 
>
>

Would maybe having $_SESSION['_Files'] == $_FILES for multiple uploads
and have the current size uploaded as a new entry in $_FILES be
easier?

That way no additional configuration option.



-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

---

## #40344 — Arnaud Le Blanc — 2008-09-08T13:47:40+00:00

URL: https://externals.io/message/40332#40344 · In reply to: #40342

Hi,

On Monday 08 September 2008 15:19:07 Richard Quadling wrote:
> 2008/9/8 Arnaud Le Blanc <arnaud.lb@gmail.com>:
> > […]
is
> > […]
available
> > […]
was
> > […]
[name].
> > […]
> 
> Would maybe having $_SESSION['_Files'] == $_FILES for multiple uploads
> and have the current size uploaded as a new entry in $_FILES be
> easier?
> 
> That way no additional configuration option.

This will not work if the user sends a request while a previous one is not 
terminated. Also, this may break some applications that use "_Files" as a key 
in $_SESSION if this is not configurable. And the entries outside of "files" 
(content_length, etc) needs to be added somewhere ;)

The "files" array in the current patch is just like $_FILES.

> 
> 
> 
> -- 
> -----
> Richard Quadling
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> "Standing on the shoulders of some very clever giants!"
> 
> -- 
> 
> 
> 
> 
> 

Regards,

Arnaud
