UploadSimpleForm
This form uploads a file and goes to the upload page afterwards.
(:input form method='post' enctype='multipart/form-data' :) (:input hidden name='n' value='{$FullName}':) (:input hidden name='action' value='postupload':) File to upload: (:input file name='uploadfile':) (:input submit value="$[Upload]":) (:input end:) |
Simon, is it possible to redirect to a specific page, after submitting the upload?
See the answer ferom Hans below. I can't find documentation about what values the name=action hidden field can have, or understanding how this hooks to the file upload mechanism, because this does work and upload files.
See Cookbook.Input
This form does not upload a file.
(:input form method='post' 'enctype=multipart/form-data' :) (:input hidden name='n' value='{$FullName}':) (:input hidden name='action' value='browse':) File to upload: (:input file name='uploadfile':) (:input submit value="$[Upload]":) (:input end:) |
The form on Test.UploadSimpleForm does upload a selected file. In order not to go to the upload page with the attachment list afterwards, you need to define your own HandleUpload function, lets call it HandleCustomUpload, and set
$HandleActions['upload'] = 'HandleCustomUpload';
you could copy HandleUpload from scripts/upload.php, rename it to HandleCustomUpload, and simply comment the last two lines and add a Redirect line:
# SDV($HandleUploadFmt,array(&$PageStartFmt,&$PageUploadFmt,&$PageEndFmt)); # PrintFmt($pagename
,$HandleUploadFmt); Redirect($pagename
);
which will result in a silent upload, no success or failure reported.
Attachment list only accessible to pmwiki.org editors.