Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:44129 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45932 invoked from network); 2 Jun 2009 23:31:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Jun 2009 23:31:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=bnagwani@juniper.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=bnagwani@juniper.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain juniper.net from 64.18.2.177 cause and error) X-PHP-List-Original-Sender: bnagwani@juniper.net X-Host-Fingerprint: 64.18.2.177 exprod7og112.obsmtp.com Linux 2.5 (sometimes 2.4) (4) Received: from [64.18.2.177] ([64.18.2.177:47159] helo=exprod7og112.obsmtp.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5C/45-15940-736B52A4 for ; Tue, 02 Jun 2009 19:31:04 -0400 Received: from source ([66.129.224.36]) (using TLSv1) by exprod7ob112.postini.com ([64.18.6.12]) with SMTP ID DSNKSiW2NOH07ih4xweEpp+pE2vo6i+UJCQa@postini.com; Tue, 02 Jun 2009 16:31:04 PDT Received: from EMBX02-HQ.jnpr.net ([fe80::18fe:d666:b43e:f97e]) by P-EMHUB02-HQ.jnpr.net ([fe80::88f9:77fd:dfc:4d51%11]) with mapi; Tue, 2 Jun 2009 16:30:25 -0700 To: Matt Wilson CC: "internals@lists.php.net" Date: Tue, 2 Jun 2009 16:30:24 -0700 Thread-Topic: [PHP-DEV] Question on file upload Thread-Index: Acnj2INuT8RW/WcNS8GlP503q0JhGgAAGggw Message-ID: References: <9461E68C-2510-4498-A837-F55FAF7F5B15@gmail.com> In-Reply-To: <9461E68C-2510-4498-A837-F55FAF7F5B15@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: RE: [PHP-DEV] Question on file upload From: bnagwani@juniper.net (Bharat Nagwani) Yes I am looking to change the C implementation. The problem is - the uploaded temp file is already created by httpd server = even before it gets to php. In php I just need to find this temp file, trim the headers and avoid file copy by php being done by following code in rfc1867.c while (!cancel_upload && (blen =3D multipart_buffer_read(mbuff, buff, sizeo= f(buff), &end TSRMLS_CC))) { if (php_rfc1867_callback !=3D NULL) { multipart_event_file_data event_file_data; event_file_data.post_bytes_processed =3D SG(read_post_bytes); event_file_data.offset =3D offset; event_file_data.data =3D buff; event_file_data.length =3D blen; event_file_data.newlength =3D &blen; if (php_rfc1867_callback(MULTIPART_EVENT_FILE_DATA, =20 &event_file_data, &event_extra_data TSRMLS_CC) =3D=3D FAILU= RE) { =20 ... While following multipart_buffer_read I cannot find the place where it is r= eading the temp file to fill this buffer. Thanks -----Original Message----- From: Matt Wilson [mailto:shadda@gmail.com]=20 Sent: Tuesday, June 02, 2009 4:22 PM To: Bharat Nagwani Cc: internals@lists.php.net Subject: Re: [PHP-DEV] Question on file upload I'm not sure if you're looking to change the C implementation or not, =20 but you could always bypass the internal processing of the file. Set =20 post_max_size to 0 and parse the HTTP_RAW_POST_DATA manually. On Jun 2, 2009, at 3:55 PM, Bharat Nagwani wrote: > Hello, > > I want to change the way file upload processing is done in php. We =20 > have a http server (appweb) > that puts the uploaded file to a temp directory. This file has =20 > headers at the beginning and end. > > I am looking at code rfc1867.c. This code takes the temp file and =20 > seems to extract the real file. > I want to change it so instead of entire file, I can run a system =20 > awk command to trim the > header lines to get the actual file. > > Has anyone done something similar? I cant find the place where the =20 > actual file is being read? > Can someone please point to that. > > This is php 5.2 on bsd. > > Thanks >