Tuesday, November 24, 2009

Re: File upload size (copy by value)

You are looking at the problem form the wrong angle. Don't store 42MB
files in the database, that's all.

Files are best stored in the filesystem. Then you store the filename
(and path) in your database. You will never even need to have the file
in php-memory at all.


/Martin


On Nov 24, 7:37 am, Наргиза Саркулова <snt.joc...@gmail.com> wrote:
> Hi,
>
> I recently implemented a file upload feature in one of my cakephp
> project following the guidelines in:
>
> http://cakebaker.42dh.com/2006/04/15/file-upload-with-cakephp/
>
> The upload feature is working nice but the only problem is that it
> requires a huge amount of memory because cakephp save function and DB
> function pass their argument by copy so for a 42 megabyte file, for
> example, I get:
>
> 5       0.6854  9126724 ApplicantdataController->attachment( )       ../object.php:
> 118
> 6       0.6855  9126724 ApplicantdataController->saveAttachments( )  ../
> applicantdata_controller.php:195
> 7       0.7750  49591836        Model->save( )       ../applicantdata_controller.php:398
> 8       0.7761  49602268        DboSource->create( ) ../model.php:1253
> 9       0.7767  49602220        DboMysql->value( )   ../dbo_source.php:571
>
> requiring a >120mega PHP request.
>
> I was wondering if it makes sense to create my own version of the save
> function passing by reference or maybe there is a better way to
> implement the file upload feature. Passing by reference should allow
> me to not have the 49mega copied twice.
>
> Thanks for your help,
> Nargiza

--

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate