I have seen some work on this question on GeoNet before, but I absolutely can't get my attachments from a hosted feature layer downloaded. I have a Survey123 feature layer with a photo repeat that I have tried exporting to a file geodatabase without success. All I get is the standard 1KB file that will not unzip. I tried creating a replica without success as well; I keep getting error messages. I also tried using a notebook with script I've found on this site, but I am so new to Python, that I have not been able to get it to work. Please help!
To confirm, you followed this workflow to try to download the fgdb? This is the only one that's always worked for me...
I was able to create a replica, but I'm not sure where the photos are actually saved, let alone the sketches from our Survey123 crew in the field are. How do I access the actual photos and know which points they belong to?
So do you have the data within a file geodatabase? If so, there should be an attachments table that will contain the photo data.
Kaitlyn Abrahamson you can use the following code to export the images:
import os, arcpy # Variables tbl = r"C:\Temp\Python\Test.gdb\Graffiti__ATTACH" # Path to attachment table fldBLOB = 'DATA' # Field name of Blob data type field in attachment table fldAttName = 'ATT_NAME' # Field name in attachment table that contains attachment name outFolder = r"C:\Temp\Python\Attachments" # Output folder to export attachments to with arcpy.da.SearchCursor(tbl,[fldBLOB,fldAttName]) as cursor: for row in cursor: binaryRep = row fileName = row # save to disk open(outFolder + os.sep + fileName, 'wb').write(binaryRep.tobytes()) print('Finished')