CDN Concept

I want to ask that Yii support multiserver concept, suppose if we make image hosting script then can we forward image files to multiple server over CDN network? is it possible with Yii? if then how to do it?

Just like facebook using CDN regarding all their multimedia

Any help will be much appreciated

Yii doesn’t have anything to do with this, only your php skills. Yii is just a tool, what you can do with it, is limited only by your php knowledges.

i mean between we move uploaded file…


move_uploaded_file to some place with php

can we do it for remote servers in yii using multiserver concept…

note that move_uploadded_file() is a PHP function…

mdomba: kindly clear that CDN is possible using Yii Framework…

Yii has several functions, native and extensions, which are capable of handling the file transfers that you’re talking about. Alternatively, there are several good APIs out there for putting files to CDNs like Amazon S3 for PHP, which you can get working in Yii with minimal effort (Yes, I have done so).

So, Yes, it’s definitely possible.

Diana +rep for your response, and i learning yii these days… so wanted to clear myself in using yii as my professional script.

Thank You

But, to be honest, mdomba did cleared this to you (and so Dana). move_uploadded_file() is a PHP function, not Yii one. If you are able to configure your server and PHP the way that it will allow (security reasons) to move file outside your main server using move_uploadded_file() then it will also be possible in Yii.

Yii isn’t anything else (in general) than one big wrapper to all PHP functions, including move_uploadded_file() among them. Perfectly written and extermely large, but still… just a wrapper, package, outline, so coding in PHP would be much, easier and with best rules by the same time.

One more, rather important, thing to notice. If I’m not mistaken, move_uploadded_file() is using HTTP protocol for transferring files. There is a limit somewhere there around 150 MB or 180 MB or similar size of file which may be transferred this way. I had this issue two or three years ago. I wanted to store large files on my personal home server, but not wanted anyone to access it. Therefore I wrote a small, simple script hosted on some free server that were first checking if destination (home) server responds (so no to waste upload to a dead destination) and then were attempting to transfer file using move_uploadded_file(). And it ended up with nothing because file transfer was breaking up after sending around 150-180 MB due to HTTP protocol limitations.

Just noticed this…

Dana, maybe you could extract that piece of your code to a formal extension and publish it in extensions repository, so everyone among community could make a use of your work?

I did so last night after having so many questions come up about CDNs yesterday. It’s just the most basic wrapper since I only included what covered my needs at the time.

The link is here:

ES3 Extension

And there is a topic created under the Extensions forum if you have any questions or requests for adding functionality.

Thank you very much! :]