Jump to content
Larry Ullman's Book Forums

User Files / Private Folders


Recommended Posts

Well,

 

This is sort of strategic question. I am already familiar with Yii but now I am in course of developing custom mailing application for an add agency. They need to have strict separation of user files, so each mailing campaign's files are stored in a separated folder named after the campaign itself. The purpose is to ensure no file is confused even in case of a database failure. And I can understand this point.

 

On the other hand, for whatever reason Yii defaults to keep all 'user asset' files in a randomly named folder and - surprisingly - the asset folder name is being changed with each Yii update. This is not nice in fact.

 

The question is - what is a recommended strategy? How to organize WYSWIG editor, file manager, all file uploaders and finally - all the content so the above mentioned asset separation is properly implemented? Please help - the problem is becoming urgent!

 

Thank's ahead,

Ziggi

Link to post
Share on other sites

Hopefully someone with more Yii knowledge and experience than me will step in to help, but for the sake of urgency, I will try to help. Just out of curiosity, what did you mean by the following:

 

On the other hand, for whatever reason Yii defaults to keep all 'user asset' files in a randomly named folder and - surprisingly - the asset folder name is being changed with each Yii update. This is not nice in fact.

 

What Yii method/module are you executing that causes this random folder to be created?

Without knowing too much about Yii, my thought is that you can choose to not use whatever method/module does the above, and instead write all text sent to clients to new text files and then save those files in folders of your choosing. The same goes for file uploads.

And of course, if the intended folder does not exist, you first create it, otherwise, you just store the file(s) in the right folder.

 

Does that help at all?

Link to post
Share on other sites

Looking at the manual, the CAssetManager is not intended for the purposes you describe here. The class is for handling site asset management, not for working with user assets.

 

I would instead look at this wiki entry. I would look into creating a model with a belongs_to relationship to the Campaigns. That way, you can define logic for creating/removing folders and handle file management inside the class, using information like campaignName for the Campaign model.

 

Just my two cents as this was urgent. I know something like this would be easy to implement. I must admit I've never worked with YII myself, only reading about the framework.

  • Upvote 2
Link to post
Share on other sites

Antonio, your remark: "CAssetManager is not intended for the purposes you describe here. The class is for handling site asset management, not for working with user assets." is of the critical importance and it is very refreshing indeed - thank you for saving me hours of pointless trials and errors!

 

And thanks a lot for guiding me to this "How to upload a file using a model" wiki entry. It seems this is the right direction I go on.

 

Thanks a lot!

Ziggi

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...