Using the Repo domain

39 views
Skip to first unread message

atk

unread,
Apr 11, 2014, 7:55:00 PM4/11/14
to wub-dis...@googlegroups.com
Hi
I am trying to use the repo domain for file upload but cannot quiet understand how to use it.
I configured the domain in site.config as follows;
/repo/ {
    domain Repo
    tar 1
    upload 1
    root $::docroot
}

From my page form, I will like to read the file selected for upload.
I assumed the upload proc should be used but I do not understand the arguments to pass to it.

Thanks

Colin McCormack

unread,
Apr 11, 2014, 9:58:12 PM4/11/14
to wub-dis...@googlegroups.com
Errr, I believe the repo domain generates its own form.  Could be wrong.

This, or something like it, generates metadata in the multipart/form-data which describes the file.  That metadata is used to determine the disposition of the file by the upload command.

<form method='post' action='.' enctype='multipart/form-data' id='upload'><label><button name='submit' type='submit' tabindex='1'>Upload</button></label> <input class='multi' name='file' type='file' tabindex='2'><input name='op' type='hidden' value='upload' tabindex='3'></form>

If you're keen to just add an upload form to a page, consider using the same techniques.  Bit complex, I know, as it has to drag stuff out of the multipart/form-data data structure.  Gives you heaps of good information about the file though.

Colin



--
You received this message because you are subscribed to the Google Groups "Wub Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wub-discussio...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

atk

unread,
Apr 16, 2014, 9:06:51 PM4/16/14
to wub-dis...@googlegroups.com
I don't think repo domain generates a form. However, the html form below is fine for what am doing.
From below, the action=".", does that mean the form will post to itself?
When I tried it, I could not find the uploaded file in the directory specified as root for repo in the site.config.

ATK

unread,
Apr 26, 2015, 5:02:32 AM4/26/15
to wub-dis...@googlegroups.com

Hi,
I will like to know how to extract the uploaded file and save it.

The form "action=/repo", the domain "/repo/" is already configured in site.config

1. Form code;

        set add_html {}   
        append add_html [<tr> [<td> [<text> fname id fname class fld title "First Name"] ]]
        append add_html [<tr> [<td> [<text> lname id lname class fld title "Last Name"] ]]
        append add_html [<tr> [<td> [<text> age id age class fld title "Age"] ]]
        append add_html [<tr> [<td> [<file> file multi name file][<hidden> name op value upload] ]]
        append add_html [<tr> [<td> [<hidden> sessid id sessid XXXXXXXXXXXX] ]]
        append add_html [<tr> [<td> [<submit> subAdd id subAdd class "fld ui-state-default ui-corner-all" [<font> class buttext {Add Me}]] ]]
               
        set add_html [<table> class tables $add_html]   
       
        set add_html [<br>][<form> frmAdd id frmAdd action [Query::encode /repo] ethod POST enctype 'multipart/form-data' {
            [<fieldset> { $add_html }]
        }]
       
        set add_html [<div> id divAdd $add_html]
        return [<div> id divAddStuff $add_html]


2. Also a direct domain is configured in site.config, in proc / function { r args } { } I received the following when the form is submitted;

proc / { r args } {
puts "root::QueryString-> [Query::parse $r]"

fname {ATK {-count 1}} lname {KOROMA {-count 2}} age {10 {-count 3}} file {1429946694572-1498506050.jpg {-count 4}} sessid {XXXXXXXXXXX {-count 5}} subAdd {{} {-count 6}}

. . . .
}

From this point on, I am not sure how to store the file "1429946694572-1498506050.jpg" using the Repo package.

I'm not sure if I should be using the Repo::upload. "upload" proc looks like;
proc upload {r Q args} {}

What is Q, querystring?

An example of uploading a file to server will be using the Repo domain will be appreciated
Reply all
Reply to author
Forward
0 new messages