You are not logged in.
jstubbs
I’ve hit that error too. Have you added the mandatory enctype="multipart/form-data" to your call to mem_form to enable file uploads?
If that doesn’t do it, you can try this edit the plugin. Look for the following in the mem_form_file() function…
if (is_uploaded_file($fname) and $max_file_size >= filesize($fname))
mem_form_store($name, $label, $_FILES[$name]);
elseif (!is_uploaded_file($fname)) {
$mem_form_error[] = mem_form_gTxt('error_file_failed', array('{label}'=>$hlabel));
$err = 1;
}
… replace it with …
if (is_uploaded_file($fname) and $max_file_size >= filesize($fname))
mem_form_store($name, $label, $_FILES[$name]);
elseif (!is_uploaded_file($fname)) {
if ($required) {
$mem_form_error[] = mem_form_gTxt('error_file_failed', array('{label}'=>$hlabel));
$err = 1;
}
}
Hope that helps.
— Steve
Textile | My plugins on GitHub | @netcarver
Offline
Thanks Steve. Patch applied and v0.5.1 is available for download.
Jonathan, the file is placed in the folder $tempdir, as dictated by textpattern’s get_uploaded_file function.
Offline
Mmm. I have this in the mem_form call:
txp:mem_form type="mem_moderation_article" label="" redirect="/my-classifieds/" redirect_form="mem_redirect_form" form_expired_msg="The form has expired. Please try again"
Because I am using this form along with mem_moderation_article, I am not sure how to use this new tag.
TXP Tips | @txptips | Me | @jonathanstubbs | Github
TXP Builders – finely-crafted code, design and txp @txpbuilders
Offline
Manfre wrote:
Jonathan, the file is placed in the folder $tempdir, as dictated by textpattern’s
get_uploaded_filefunction.
Hi Michael. Thanks for the that. So – what is the best way to access the uploaded file? Particularly if the file is attached to a moderated article submission?
TXP Tips | @txptips | Me | @jonathanstubbs | Github
TXP Builders – finely-crafted code, design and txp @txpbuilders
Offline
Jonathan
So – what is the best way to access the uploaded file? Particularly if the file is attached to a moderated article submission?
Depends what you want to do with it! If you’re just downloading via sftp or something — potentially nothing. If you want it automatically made available for access/download from your TXP installation you’ve got a little more work to do.
AFAIK, you’ll need to use a custom form for mem_moderation_article that includes a mem_form_file entry (and add the enctype to the enclosing mem_form.) After that you’ll need to do some custom handling of the uploaded file to transfer it into the txp files area & DB on successful submission/moderation acceptance of article.
This is essentially what sed_afu has been doing (sans the article stuff.) Now Manfre’s fixed up mem_form, I intend to rewrite sed_afu to use it
In the meantime, if I hit on the answer to your question I’ll let you know!
— Steve
Textile | My plugins on GitHub | @netcarver
Offline
Dear All,
Greetings!
As I had earlier post regarding fileupload using some textpattern plugin. I was suggested to post on this thread for mem_form plugin.
My requirement: Actually our client need send bigger files using FTP. What I thought is, It would be better for the client(in terms of their convenience) to upload the stuff by going through the website. For this, I would first use ign_password_protect plugin to authenticate the user. If authentication is successful, then user will be shown upload form.
Upload file would be going to public_html/files folder. It’s not necessary to insert into the Txp’s files table. Is this possbile using the mem_form plugin and what about the security risk if yes?
Thank you all for your help
Sheru
Offline
Sheru
My requirement: Actually our client need send bigger files using FTP. What I thought is, It would be better for the client(in terms of their convenience) to upload the stuff by going through the website. For this, I would first use ign_password_protect plugin to authenticate the user. If authentication is successful, then user will be shown upload form.
I’m assuming all these users are known clients right? Or will they be creating their own logins via mem_self_register too?
Upload file would be going to public_html/files folder. It’s not necessary to insert into the Txp’s files table. Is this possbile using the mem_form plugin and what about the security risk if yes?
Manfre’s plugin uploads the file to the $tempdir directory (/textpattern/tmp by default IIRC) with a random filename. If you want it moved and renamed — and that’s a pretty good idea — then you’ll need some code to do it. Manfre’s examples are the place to start but they only illustrate deletion of the uploaded file rather than moving it to another directory. At the very least you’d want to notify whoever’s going to download them of the location and name of the uploaded file.
If you don’t insert them into the DB you can’t use txp’s categories or other meta-info in your pages and forms to list them on your site so you’d have to rely on your webserver’s automatic indexing of the /files folder. This might not be a good idea if there is any confidential data in those documents.
— Steve
Textile | My plugins on GitHub | @netcarver
Offline
Dear Steve,
Greetings!
Thank you so much for your valuable time for my post.
I’m assuming all these users are known clients right? Or will they be creating their own logins via mem_self_register too?
Yes these are known clients. They won’t create their own logins. We will create and give them login details.
If you don’t insert them into the DB you can’t use txp’s categories or other meta-info in your pages and forms to list them on your site so you’d have to rely on your webserver’s automatic indexing of the /files folder. This might not be a good idea if there is any confidential data in those documents.
I am open to insert into database as long as my requirement fulfills. Hope to be in touch.
Thank you so much for your time and kind help
Sheru
Last edited by Sheru (2008-09-17 04:18:01)
Offline
Sheru, since you mentioned large file uploads, make sure that PHP, textpattern and mem_form are configured to allow files of the size you desire. The current restriction is 2 MB.
Jonathan, now that I have file upload support in mem_form, I am in the process of updating mem_moderation_image to support mem_form. This will have the functionality that you wanted when we last spoke about the tennis site.
Offline
I’m using mem_form in conjunction with mem_simple_form to pass user-submitted articles directly into my textpattern table— Woohoo! Works great! There are a few things I’m trying to tweak for a better user experience:
mem_form_checkbox parses into the database as “Yes” or “No” based on whether or not it’s checked. The custom field I have assigned to this field uses glz_custom_fields to pass a string of my own text to the database only if it’s checked. This way I can use a txp:if_custom_field conditional to output the string when there’s data, and ignore it when there’s not. I think I could re-jigger my conditional statement to do it based on “Yes” or “No”, but I’d rather keep it consistent with the admin-side. Does that make sense?mem_form_select_category works great— but I have thousands of categories. Is there a way I could use display an input field and allow users to select a category that matches their input as they type? I see this behavior in a lot of web forms, notably Facebook’s note/photo tagging field, which allows you to begin entering a name, showing you selectable matches in a dropdown display as you type. mem_form_select_category is the only way I can get the form to parse a category1 string— text input doesn’t work (and unrestricted text input could have very bad results). Not sure what do do.Any suggestions? Once again, the mem_form and mem_simple_form is a super-hero dynamic duo for the project I’m working on, and I can’t wait to get paid again so that I can donate!
Offline