Topic
  • 1 reply
  • Latest Post - ‏2011-03-17T08:37:49Z by swu428
swu428
swu428
2 Posts

Pinned topic How to upload excel file using iframe.send

‏2011-03-17T08:36:19Z |
Hi guys:
I am trying to implement a widget to allow user upload excel files and create feeds for them automatically. This is basically very similar to the excel worksheet feed with some additional functions.

As a first step, I need to upload the excel file. I try to use dojo.io.iframe.send(), here is a copy of my code:
iframeUpload: function(objectId){
var form = dojo.byId("_" + this.iContext.widgetId + "_formNode");
var excelFilePath = dojo.byId("_" + this.iContext.widgetId + "_excelFilePath").value;
console.debug("form=", form);
console.debug("excel=", excelFilePath);
dojo.io.iframe.send({
form: form,
url: "/mashuphub/client/plugin/ajax/pluginid/3/entryid/" + objectId + "/method/handleUpload/transport/iframe",
method: "post",
handleAs: "json",
handle: function(response, args){
if(response instanceof Error){
alert("Excel file uploading failed");
}
console.debug("upload excel file");
console.debug(response);
console.debug(args);
return response;
}
});
}

The response I got has an error message like:
"CDHFD0107E: The location of a valid excel file was not provided."

Does any one know what I made wrong? Thank you in advance for your time.

Regards,
Shiwei
Updated on 2011-03-17T08:37:49Z at 2011-03-17T08:37:49Z by swu428
  • swu428
    swu428
    2 Posts

    Re: How to upload excel file using iframe.send

    ‏2011-03-17T08:37:49Z  
    Front end as:

    <form enctype="multipart/form-data" id="_${widgetId}_formNode">
    <input type="file" id="_${widgetId}_excelFilePath" size="90">
    <input type="button" onclick="_${widgetId}_iContext.iScope().getInputURL()" value="Generate">
    </form>