Group Abstract Group Abstract

Message Boards Message Boards

0
|
5.3K Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Problem Storing Image In DataBin from FormFunction

Posted 10 years ago

I have an issue being able to store an image in a DataBin when called from a CloudDeployed FormFunction

All character and value entries can be stored but the image will not store. The same code when called from the desktop has no issues storing images. Is there a work around or some permissions that need to be set. I have set the access permissions for the Databin to be public and all Permissions of the cloud deployed object are also public.

Some example code is given below:

CloudDeploy[
 FormFunction[{"image" -> <|"Interpreter" -> "Image", 
     "Label" -> "Fruit Image"|>, 
   "value" -> <|"Interpreter" -> "Number", "Label" -> "Amount"|>, 
   "day" -> <|"Interpreter" -> Range[1, 31, 1], "Label" -> "Day", 
     "Input" -> ToString[ DateList[Today][[3]]]|>,
   "month" -> <|"Interpreter" -> Range[1, 12, 1], "Label" -> "Month", 
     "Input" -> ToString[ DateList[Today][[2]]]|>,
   "year" -> <|
     "Interpreter" -> {ToString[ DateList[Today][[1]] - 1] -> 
        DateList[Today][[1]] - 1, 
       ToString[ DateList[Today][[1]]] -> DateList[Today][[1]]}, 
     "Label" -> "Year", "Control" -> RadioButtonBar, 
     "Input" -> ToString[DateList[Today][[1]]]|>,
   "fruit" -> <|
     "Interpreter" -> {"Apples" -> "Apples", "Pears" -> "Pears", 
       "Other" -> "Other"}, "Label" -> "Pick Your Fruit", 
     "Control" -> RadioButtonBar, "Input" -> "Other"|>}, 
  Module[{recieptLabel, outputImage, processedImage, dateString, 
     fileID, dateList , dataBinID = "blah" , id, dataBinData, 
     dataBinPointer, binReturn, imageTag},
    dateList = {ToExpression[#year], ToExpression[#month], 
      ToExpression[#day]};
    id = ToExpression[
       Databin["someDataBinID"]["Latest"]["Data"]["fruitid"]] + 1;
    Databin["dataBinID"][
     "Add", <|"fruitid" -> ToString[id], "fruit" -> #fruit, 
      "Date" -> DateList[dateList], "OutputImage" -> #image, 
      "amount" -> #value|>];
    (*Return[outputImage]*)
    Return["Fruit Added :)"]] &, "HTML", 
  AppearanceRules -> {"Title" -> "Pick Your Own Fruit"}], 
 Permissions -> "Public"]
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard