The issue is not solved but I was able to generate error messages that may help a more knowledgeable person reading this (goal is upload XLS sheet via Wolfram Cloud Web Form Submit)
FormFunction[
"fname" -> "String",
Module[{},
st1 = "E:\\testfolder\\" <> #fname;
st2 = #fname;
SetCloudDirectory[$CloudRootDirectory];
SetCloudDirectory["results"];
zz = CloudObject[st2];
{EvaluationData[CopyFile[st1, zz]]}
] &
][]
This (above) runs from the Mathematica desktop application (and works fine) and generates the following evaluation data:
{<|"Result" -> CloudObject[
"https://www.wolframcloud.com/objects/user-9b714558-a731-4b6e-9313-\
00431f13aa06/results/xlsbook4.xls"], "Success" -> True,
"FailureType" -> None, "Messages" -> {}, "MessagesText" -> {},
"MessagesExpressions" -> {}, "Timing" -> 1.076,
"AbsoluteTiming" -> 2.48, "InputString" -> "CopyFile[st1, zz]"|>}
The next example is extended with CloudDeploy and is NOT a success. See error message generated by webform:
--code --
CloudDeploy[FormFunction[
"fname" -> "String",
Module[{},
st1 = "E:\\testfolder\\" <> #fname;
st2 = #fname;
SetCloudDirectory[$CloudRootDirectory];
SetCloudDirectory["results"];
zz = CloudObject[st2];
{EvaluationData[CopyFile[st1, zz]]}
] &
]]
(error message )
{<|"Result" -> $Failed, "Success" -> False,
"FailureType" -> "MessageFailure",
"Messages" -> {FileFormat::nffil, StringMatchQ::strse,
BinaryReadList::nffil, CloudObject::srverr},
"MessagesText" -> {"FileFormat::nffil : File not found during \
FileFormat[E:\\testfolder\\xlsbook4.xls].",
"StringMatchQ::strse : String or list of strings expected at \
position 1 in StringMatchQ[$Failed, __~~/~~__].",
"BinaryReadList::nffil : File not found during \
BinaryReadList[E:\\testfolder\\xlsbook4.xls].",
"CloudObject::srverr : An unknown server error occurred."},
"MessagesExpressions" -> {Hold[
Message[FileFormat::nffil,
HoldForm[FileFormat["E:\\testfolder\\xlsbook4.xls"]]]],
Hold[Message[StringMatchQ::strse, HoldForm[1],
HoldForm[StringMatchQ[$Failed, __ ~~ "/" ~~ __]]]],
Hold[Message[BinaryReadList::nffil,
HoldForm[BinaryReadList["E:\\testfolder\\xlsbook4.xls"]]]],
Hold[Message[CloudObject::srverr]]}, "Timing" -> 0.01,
"AbsoluteTiming" -> 0.01, "InputString" -> "CopyFile[st1, zz]"|>}
The code below is including the File[st1] command and seems to work a little better but still Success is false:
( looks like there is no access to the local disk anymore... but how to provide that access)
(* code *)
CloudDeploy[FormFunction[
"fname" -> "String",
Module[{},
st1 = "E:\\testfolder\\" <> #fname;
st2 = #fname;
SetCloudDirectory[$CloudRootDirectory];
SetCloudDirectory["results"];
zz = CloudObject[st2];
{EvaluationData[CopyFile[File[st1], zz]]}
] &
]]
(* error data *)
{<|"Result" ->
CloudObject[
"https://www.wolframcloud.com/objects/user-9b714558-a731-4b6e-\
9313-00431f13aa06/results/xlsbook5.xls"], "Success" -> False,
"FailureType" -> "MessageFailure",
"Messages" -> {StringMatchQ::strse,
"`1` is not a string, InputStream[ ], or OutputStream[ ]."},
"MessagesText" -> {"StringMatchQ::strse : String or list of strings \
expected at position 1 in StringMatchQ[FileFormat[File[E:\\testfolder\
\\xlsbook5.xls]], __~~/~~__].",
"General::stream : File[E:\\testfolder\\xlsbook5.xls] is not a \
string, InputStream[ ], or OutputStream[ ]."},
"MessagesExpressions" -> {Hold[
Message[StringMatchQ::strse, HoldForm[1],
HoldForm[
StringMatchQ[
FileFormat[File["E:\\testfolder\\xlsbook5.xls"]], __ ~~
"/" ~~ __]]]],
Hold[Message[General::stream,
HoldForm[File["E:\\testfolder\\xlsbook5.xls"]]]]},
"Timing" -> 1.0230000000000001, "AbsoluteTiming" -> 1.27,
"InputString" -> "CopyFile[File[st1], zz]"|>}
hope this info helps with ideas on how to resolve this issue. Kind Regards, pvanbijnen.