I am attempting to upload a file (I have tried shapefile.zip and GeoJSON) using the createItem function from arcgis-rest-portal. The file is local and not passed via a form. Do I pass a local path? Or a byte array? Whatever I try does not seem to work.

    item: {
        title: 'Test',
        type: 'Shapefile',
        description: 'Test upload'
    file: '../data/test.zip' // What goes here?
    filename: 'test.zip',
    multipart: true

I managed to get it working by using: data = fs.createReadStream('../data/test.json') Then passing data to the file: parameter and removing the multipart: true line. I thought it must be multipart in order to upload a file according to docs. Any light on this would be greatly appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.