@@ -0,0 +1,1464 @@
+#dependencies%0Aimport os%0Aimport mechanize%0A%0Abr = mechanize.Browser() #creates Mechanize browser object%0Adirectory = os.getcwd() #grabs current working directory%0A%0AformName = %22upload%22 #name of HTML form%0AmimeType = 'image/jpg' #MIME type of file to be uploaded%0AfileExtension = %22.jpg%22 #extension of file to be uploaded%0AfileTotal = 0 # total files of fileExtension in directory%0AuploadedTotal = 0 #total files uploaded%0AerrorTotal = 0 #total number of failed uploads%0A%0Afor filename in os.listdir(directory):%0A%0A%09if filename.endswith(fileExtension):%0A%09%0A%09%09#grab filename without extension%0A%09%09fileWithoutExt = os.path.splitext(os.path.basename(filename))%5B0%5D%0A%09%09#split name by spaces so that reports with several parts get uploaded correctly e.g. '20151503 part1' and '20151503 part2' to '20151503'%0A%09%09file = fileWithoutExt.split(%22 %22)%5B0%5D%0A%09%09#get URL corresponding to file%0A%09%09url = %22http://example.com/view.php?view=%22+filename # URL%0A%09%09fileTotal += 1%0A%09%09%0A%09%09try:%0A%09%09%09br.open(url)%0A%09%09%09br.select_form(name=formName)%0A%09%09%09br.form.add_file(open(filename, 'rb'), mimeType, filename)%0A%09%09%09br.submit()%0A%09%09%09print filename+%22 uploaded to %22 +url%0A%09%09%09uploadedTotal += 1%0A%09%09#error handling%0A%09%09except:%0A%09%09%09pass%0A%09%09%09errorTotal += 1%0A%09%09%09print %22Unexpected error occured when trying to upload %22+filename+%22 to %22+url%0A%0Aprint %22TOTAL %22+fileExtension+%22 FILES IN DIRECTORY: %22+str(fileTotal)%09%09%09%0Aprint %22TOTAL FILES UPLOADED: %22+str(uploadedTotal)%0Aprint %22ERRORS: %22+str(errorTotal)%0Aprint %22DONE. PRESS %5BENTER%5D KEY TO EXIT%22%0Araw_input()%0A

Create py-uploader.py