A possible solution is to create a geoprocessing service for upload and convert the files to features
the following example used foe convert the DWG to features
import glob, zipfile, arcpy
def dwgToFeatures(dwgFile):
arcpy.AddMessage("dwgToFeatures")
arcpy.CADToGeodatabase_conversion(dwgFile, arcpy.env.scratchGDB, "DWGTestData_CADToGeodatabase", "204657", "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];-400 -400 11258999068426,2;-1073,7418235 4194304001953,12;-100000 10000;8,98315284119522E-09;0,001;0,001;IsHighPrecision")
return arcpy.env.scratchGDB + "/DWGTestData_CADToGeodatabase/Polygon"
def ProcessInput():
sourceDWGFile = arcpy.GetParameterAsText(0)
outputFeatureClass = dwgToFeatures(sourceDWGFile)
arcpy.SetParameterAsText(1, outputFeatureClass)
ProcessInput()
then on the Javascript application create the Upload Form
sent the uploaded file on the geoprocessing service and get the result features (don't forget to enable the upload service on the geoprocessing service)
you can add the result features on a graphic layer on the map and/or apply the geometries on a feature service in order to store on the geodatabase.
SAMPLE JS code to sent the file on the upload service
---------------------------------------------------------------------------------------------------
var requestHandle = esri.request({
url: "GEOPROCESSING SERVICE URL",
form: dojo.byId("uploadForm"),
content: { f: "json" },
handleAs: "json",
load: uploadSucceeded,
error: uploadFailed
});
SAMPLE JS code to sent the request on the geoprocessing service
---------------------------------------------------------------------------------------------------
function uploadSucceeded(response, io) {
......
if(filetype === 'dwg'){
var params= { "uploadDWGFile": "{'itemID':" + itemID + "}" };
gpTaskdwg.setOutSpatialReference({wkid:102100});
gpTaskdwg.execute(params, displayResult, errorGP);
}
....
}