Hi,

Friday, November 5, 2004, 8:42:49 PM, you wrote:
KR> Marcus Boerger wrote:
>> Thinking about it another time you're right. So what the patch offers is
>> all we can do. However having the session id available somehow would make
>> the the patch usefull. 

KR> I have some ideas for this. It may even be possible to remove the 
KR> UPLOAD_IDENTIFIER-stuff from the patch and move it to the PHP extension.
KR> This would make the patch more independant. The author of the PHP 
KR> extension can decide how this variable is named and how it is transmitted.

KR> If nobody has already a working solution I can give it a try this weekend.

KR> But one question stays: Let's say that the PHP extension now knows the 
KR> PHP session ID during progress tracking (because it was passed like the 
KR> UPLOAD_IDENTIFIER via a POST variable BEFORE the uploaded files). What 
KR> can the extension do with it? Is it possible for this PHP extension to 
KR> open the session, update variables in it, and close it again? Or is the 
KR> stage in which the callback is called to early for doing so?

here are some changes I made to make a thread safe file upload. The diffs are
against 4.3.8 but should be close enough. I am not an expert by any means but it
may help

-- 
regards,
Tom
File difference report generated by CSDiff by ComponentSoftware on 6/11/2004 10:07 AM

Base file: C:\work\php-4.3.8\Zend\zend_globals_macros.h
Compared file: D:\phpgtk\php4\Zend\zend_globals_macros.h

27a28
> typedef struct _zend_fus_globals zend_fus_globals;
56a58,65
> #endif
> 
> /* File Upload */
> #ifdef ZTS
> # define FUSG(v) TSRMG(fus_globals_id, zend_fus_globals *, v)
> #else
> # define FUSG(v) (fus_globals.v)
> extern ZEND_API zend_fus_globals fus_globals;


<---------------------  End of report  --------------------->

File difference report generated by CSDiff by ComponentSoftware on 6/11/2004 10:05 AM

Base file: C:\work\php-4.3.8\main\rfc1867.c
Compared file: D:\phpgtk\php4\main\rfc1867.c

772a773,776
>       /* file upload status variables */
>       zend_bool file_upload_status = 0;
>       char *file_upload_status_filename = NULL;
>       FILE *file_upload_status_fp;
900a905,911
>                               
>                               /* Check for upload status hidden variable */
>                               if (strcasecmp(param, FUSG(hidden_variable_name)) == 
> 0) {
>                                       file_upload_status = 1;
>                                       file_upload_status_filename = 
> emalloc(strlen(FUSG(temp_file_dir)) + strlen(FUSG(temp_file_prefix)) + strlen(value) 
> + 2);
>                                       sprintf(file_upload_status_filename, 
> "%s/%s%s", FUSG(temp_file_dir), FUSG(temp_file_prefix), value);
>                               }
968a980,987
>                               /* Write file upload status to file */
>                               if (file_upload_status) {
>                                       file_upload_status_fp = 
> fopen(file_upload_status_filename, "w");
>                                       if(file_upload_status_fp) {
>                                               fprintf(file_upload_status_fp, "%li 
> %li %li", SG(read_post_bytes), SG(request_info).content_length, 0);
>                                               fclose(file_upload_status_fp);
>                                       }
>                               }
970a990,998
>                       
>                       /* Write file upload "complete" status to file */
>                       if (file_upload_status) {
>                               file_upload_status_fp = 
> fopen(file_upload_status_filename, "w");
>                               if(file_upload_status_fp) {
>                                       fprintf(file_upload_status_fp, "%li %li 
> %li",SG(read_post_bytes), SG(request_info).content_length,1);
>                                       fclose(file_upload_status_fp);
>                               }
>                       }


<---------------------  End of report  --------------------->

File difference report generated by CSDiff by ComponentSoftware on 6/11/2004 10:06 AM

Base file: C:\work\php-4.3.8\sapi\cli\php_cli.c
Compared file: D:\phpgtk\php4\sapi\cli\php_cli.c

519a520
>       zend_fus_globals *fus_globals;
571a573
>       fus_globals = ts_resource(fus_globals_id);


<---------------------  End of report  --------------------->

File difference report generated by CSDiff by ComponentSoftware on 6/11/2004 10:05 AM

Base file: C:\work\php-4.3.8\Zend\zend.c
Compared file: D:\phpgtk\php4\Zend\zend.c

82a83
> ZEND_API int fus_globals_id;
370a372,373
> static void fus_globals_ctor(zend_fus_globals *fus_globals TSRMLS_DC)
> {
371a375,379
> }
> static void fus_globals_dtor(zend_executor_globals *fus_globals TSRMLS_DC)
> {
>       
> }
418a427
>       zend_fus_globals *fus_globals;
485a495
>       ts_allocate_id(&fus_globals_id, sizeof(zend_fus_globals), (ts_allocate_ctor) 
> fus_globals_ctor, (ts_allocate_dtor) fus_globals_dtor);
489a500
>       fus_globals = ts_resource(fus_globals_id);


<---------------------  End of report  --------------------->

File difference report generated by CSDiff by ComponentSoftware on 6/11/2004 10:08 AM

Base file: C:\work\php-4.3.8\Zend\zend_globals.h
Compared file: D:\phpgtk\php4\Zend\zend_globals.h

48a49
> ZEND_API extern int fus_globals_id;
275a277,281
> struct _zend_fus_globals {
>       char *temp_file_dir;
>       char *temp_file_prefix;
>       char *hidden_variable_name;
> };


<---------------------  End of report  --------------------->

File difference report generated by CSDiff by ComponentSoftware on 6/11/2004 10:07 AM

Base file: C:\work\php-4.3.8\main\main.c
Compared file: D:\phpgtk\php4\main\main.c

365a366,371
> /* file upload status settings */
>     STD_PHP_INI_ENTRY("file_upload_status.temp_file_dir", "/tmp", PHP_INI_ALL, 
> OnUpdateString, temp_file_dir, zend_fus_globals, fus_globals)
>     STD_PHP_INI_ENTRY("file_upload_status.temp_file_prefix", "file_upload_status_", 
> PHP_INI_ALL, OnUpdateString, temp_file_prefix, zend_fus_globals, fus_globals)
>     STD_PHP_INI_ENTRY("file_upload_status.hidden_variable_name", 
> "file_upload_status_uniqueid", PHP_INI_ALL, OnUpdateString, hidden_variable_name, 
> zend_fus_globals, fus_globals)
> 
> 
1068a1075
>       zend_fus_globals *fus_globals;
1122a1130
>       fus_globals = ts_resource(fus_globals_id);


<---------------------  End of report  --------------------->

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to