Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
uploading images (or files, for that matter) from the public side
Hi,
I’m trying to upload an image from a plugin that will run in the public side… I think I’m doing things rather ‘by the book’, however, I can’t find my file anywhere :-(
What I want to do is something along the lines of what was asked for here
I’m preparing a couple of tags to add to the comments and comment_form forms. The latter would have an <input type="file" />
tag to upload the image and the former would be a tag to show the image.
I didn’t advance on the internals (‘though I have an idea of what to do), simply because I can’t upload the file…
Is Textpattern somehow preventing the $_FILES
array from being filled if I’m on the public side?
Is there a way to circumvent this?
The tag in the comment_form form would have something like this:
$ort_image_name = $_FILES['ort_image']['name']; $out .= "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"$max_file_size\" />\n"; $out .= "<input type=\"file\" name=\"ort_image\" value=\"$ort_image_name\" size=\"$isize\" class=\"$class\" id=\"ort_image\" />\n"; return $out;
however, whether I press preview or submit $_FILES
is always empty…
Any hints?
Mariano Absatz – El Baby
I don’t suffer from insanity. I enjoy every minute of it.
Offline
Re: uploading images (or files, for that matter) from the public side
Does your HTML form tag have the enctype="multipart/form-data"
attribute set?
Otherwise I don’t think $_FILES will contain anything. TXP itself doesn’t prevent this.
Offline
Re: uploading images (or files, for that matter) from the public side
YES!
You’re right… that was it… silly of me… now I have to think if there’s an elegant way to add that to the standard comment form (I seriously doubt it) or what else I can do.
Thanx a lot, ruud.
Mariano Absatz – El Baby
I don’t suffer from insanity. I enjoy every minute of it.
Offline