Yes, you can do this. Pre-built solutions include LibraryThing for books and Readerware for books+music+movies. They usually crawl Amazon and other ISBN/UPC databases to match your scans with metadata, downloading titles, authors, cover images, etc. for you.
My experience is with scanning books with Readerware. A $20 barcode scanner and a Windows laptop works a LOT better than a smartphone; their smartphone app wasn’t very advanced and the smartphone focusing is slower and more error-prone than the lightning-quick laser barcode reader.
If you want to homebrew it, there are websites that let you do batch UPC lookups. You can also make your own barcode using one of: Excel plugins, custom software, barcode fonts.
ETA: Sorry, I wasn’t very clear about the smartphone aspect. Readerware specifically lets you scan with your smartphone and add titles to your catalog, but ONLY if you have their desktop software too. There are other similar apps out there, or you can just scan a list of barcodes from the phone and process them on a PC later. In any case, though I personally found the PC + laser barcode reader easier/quicker than a smartphone-based solution. Not to mention cheaper by a few hundred dollars.