summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorNick Holliday <n.g.holliday@gmail.com>2010-03-23 16:50:24 +0000
committerCraig Andrews <candrews@integralblue.com>2010-03-26 18:28:54 -0400
commit260f00d60bc83ac641d6fbe465e70aec33ccd9be (patch)
tree881c63245e4a24b0f7cb2faf40ba52186160ca76 /actions
parent92ded7c6cb56056a89bc8b3caabd08049104898e (diff)
Multiple file upload handling.
Diffstat (limited to 'actions')
-rw-r--r--actions/newnotice.php35
1 files changed, 18 insertions, 17 deletions
diff --git a/actions/newnotice.php b/actions/newnotice.php
index ed0fa1b2b..2aa354870 100644
--- a/actions/newnotice.php
+++ b/actions/newnotice.php
@@ -164,22 +164,25 @@ class NewnoticeAction extends Action
$replyto = 'false';
}
- $upload = null;
- $upload = MediaFile::fromUpload('attach');
-
- if (isset($upload)) {
-
- $content_shortened .= ' ' . $upload->shortUrl();
-
- if (Notice::contentTooLong($content_shortened)) {
+ $uploads = array();
+ foreach($_FILES as $name => $value) {
+ if(substr($name, 0, 6) == "attach") {
+ $upload = MediaFile::fromUpload($name);
+ if (isset($upload)) {
+ $content_shortened .= ' ' . $upload->shortUrl();
+ }
+ }
+ }
+ if (Notice::contentTooLong($content_shortened)) {
+ foreach($uploads as $upload) {
$upload->delete();
- $this->clientError(
- sprintf(
- _('Max notice size is %d chars, including attachment URL.'),
- Notice::maxContent()
- )
- );
}
+ $this->clientError(
+ sprintf(
+ _('Max notice size is %d chars, including attachment URL.'),
+ Notice::maxContent()
+ )
+ );
}
$options = array('reply_to' => ($replyto == 'false') ? null : $replyto);
@@ -197,12 +200,10 @@ class NewnoticeAction extends Action
$notice = Notice::saveNew($user->id, $content_shortened, 'web', $options);
- if (isset($upload)) {
+ foreach($uploads as $upload) {
$upload->attachToNotice($notice);
}
-
-
if ($this->boolean('ajax')) {
header('Content-Type: text/xml;charset=utf-8');
$this->xw->startDocument('1.0', 'UTF-8');