Description Usage Arguments Details Value Author(s) References Examples
Get the URL for a file uploaded by a worker as part of a QuestionForm HIT, or download the file(s) directly to the working directory.
1 2 3 4 | GetFileUpload(assignment, questionIdentifier, download = FALSE,
open.file.in.browser = FALSE,
verbose = getOption('MTurkR.verbose', TRUE),
...)
|
assignment |
A character string containing an AssignmentId, or a vector of character strings each containing an AssignmentId. |
questionIdentifier |
A question identifier for a file upload question, as specified in the |
download |
A logical specifying whether the file(s) should be downloaded and saved in the working directory. Default is |
open.file.in.browser |
A logical specifying whether the file should be opened in the user's default web browser. |
verbose |
Optionally print the results of the API request to the standard output. Default is taken from |
... |
Additional arguments passed to |
Note that a FileUploadURL is only valid for 60 seconds (per MTurk documentation), so URLs should either be retrieved one at a time or files should be automatically downloaded to the working directory with the download = TRUE
. If browser = TRUE
, request is executed in the user's default web browser, whereas if open.file.in.browser = TRUE
, the request is executed in R and the file itself is opened in the browser.
If downloaded, files are saved in the local directory with names of the form “QuestionIdentifer_AssignmentId_UploadedFileName.UploadedFileExtension”. One may want to use setwd
to move to an appropriate directory before initiating this operation with download = TRUE
.
geturls()
is an alias.
A data frame containing the AssignmentId, questionIdenifier, temporary file URL, and an indicator of whether each request was valid.
Thomas J. Leeper
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## Not run:
a <- GenerateExternalQuestion("http://www.example.com/","400")
hit1 <-
CreateHIT(title = "Upload a file",
description = "Upload a file",
reward = ".10",
duration = seconds(days=1),
keywords = "file, upload",
question = a$string)
ExpireHIT(hit1$HITId)
a <- GetAssignments(hit = hit1$HITId)
f <- GetFileUpload(a, "dictation", download = TRUE)
# cleanup
DisposeHIT(hit1$HITId)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.