Open MarinoRaul opened 12 years ago
Hey MarinoRaul, I'm working on an auto-generated file upload feature but it may take me a bit of time to get it done. So currently there's no recommended way to do it but what we are using here is http://malsup.com/jquery/form/ which is then styled using bootstrap UI elements. on the back-end we store the files to our CDN and save the full URL to the file in the database as a string.
@jasonhinkle Isn't this outside the scope of the framework? isn't it like if you would like to add an upload function, that you should open up the View template, then add additional javascript yourself, then write some php that handles the file send and saving?
@MarinoRaul I would create a databasetable called "site_options". In this I would put the following fieldnames:
option_id(index auto_increment), option_name, option_value
So the first entry of this table could be:
id = 1
option_name = upload_folder
option_value = /uploads/
Then in your code you code ask for this option by doing something like this:
<?php $this->eprint($this->ROOT_URL) . $this->$options->$option_name('upload_folder'); ?>
Or something like that. Just a suggestion
Building on that logic you could add:
id = 2
option_name = admin_email
option_value = admin@phreeze.nl
id = 3
option_name = smtp_url
option_value = mail.phreeze.nl
id = 4
option_name = smtp_port
option_value = 110
etc
@jasonhinkle If you would like to build this kind of extra functionality, I would like to see an more advanced builder.
Right now you can load in tables and their structure. I might be awesome to further define the table fields. So that you can specify that a field is a password field or a upload field.
In case of a password field you could then load a special javascript SHA1 file through LABjs, so that the password get's encrypted. And in case of a mediaupload field, it will load some thumbnail stuff and stores the file in a folder and the url and size in the database.
I guess you could say that Phreeze has two parts - the framework and the generator.
The framework itself doesn't really care about whether you're uploading a file - it's really just concerned with request routing and the structure of the app.
The code generator, I would definitely like more convenience code like file uploaders and such. But the tricky part, as you mention, a more advanced generator UI is needed so you can customize individual columns in the app. I'd say that wouldn't really be outside the scope of the generator to do that, it's just a bit of work to do it in a clever way that doesn't clunk up the builder. I definitely would like to do it though, because writing file uploaders can be tedious - it's definitely a very basic use-case, and I would love to have them generated automatically!
@jasonhinkle Would it be an idea to let the builder guide you through every table seperatly?
So first analysis gives me the table called 'users'. Then I could define the Singular name, the Plural and the prefix. Then you could ask: Does this table need extra tweaking? If you say yes, then you could specify what field is what. Say field 'user_pass', which can be specified as a 'password field'.
in this case when building the template file, when rendering the form with the field you could add
<input type="password" />
and handle cool stuff
I was kinda imagining that each table in the generator view would be like an expandable node which would slide down to reveal the columns in that table - allowing you to select some kind of pre-made input type (file upload, password, etc)
I agree,one page is great.
I have been thinking about the upload file form, that is generated in the builder and have my thought about it: You will end up adding a path to the database table entry on save. This means you will have only one image connected to this particular database entry, which can not be used in other parts of the app. I'd rather have a Question in the builder, which ask for the path of the uploadfolder and stores this the same way it stores the location of the phreeze libs. This way you will have Phreeze facilitating the very basics and then the user can choose his own uploadsystem (on of many from the internet).
Yea I'd like to add a bunch of options for different kinds of controls, file upload, rich text editor, maybe masked editor, etc. The builder needs to be re-written to do that and I think also what will help is if the builder generates some kind of "build config" file that you can then re-load when you re-generate the app. because otherwise if you generate an app but you make like 10-20 custom field selections, you would not want to have to remember to re-select those every time you re-generate your app!
Would be nice indeed. Right now it's allready a pain when I have to re-generate after I decided to make some database adjustments
There are notices about this topic, there are someone that implement file uploader with phreeze successfully?
Hello! What would be the correct way to add a field that is input file type for the user to select a file from your computer and may come up, such as a picture ...
Thank you very much!