Поиск в Поддержке

Избегайте мошенников, выдающих себя за службу поддержки. Мы никогда не попросим вас позвонить, отправить текстовое сообщение или поделиться личной информацией. Сообщайте о подозрительной активности, используя функцию «Пожаловаться».

Learn More

How to store images in IndexedDB with possible same key name?

  • 1 ответ
  • 1 имеет эту проблему
  • 26 просмотров
  • Последний ответ от cor-el

more options

The question is a little abstract so let me explain.

Suppose I make a webpage solely for offline use, say an Image Viewer so that users can view their photos full screen.

The user has the option to either select files or drag n drop files https://developer.mozilla.org/en-US/docs/Using_files_from_web_applications

The files are then iteratively stored in IndexedDB.

When the user closes the browser and comes back the next day and opens up the webpage, the images are automatically loaded instead of having the user select the images again.

The problem comes when the user first uploads the images. Some images might have the same name.

Do I have to check if the 'key' already exists in the DB before hand or can I store the file path of the images in the DB as the key?

The question is a little abstract so let me explain. Suppose I make a webpage solely for offline use, say an Image Viewer so that users can view their photos full screen. The user has the option to either select files or drag n drop files https://developer.mozilla.org/en-US/docs/Using_files_from_web_applications The files are then iteratively stored in IndexedDB. When the user closes the browser and comes back the next day and opens up the webpage, the images are automatically loaded instead of having the user select the images again. The problem comes when the user first uploads the images. Some images might have the same name. Do I have to check if the 'key' already exists in the DB before hand or can I store the file path of the images in the DB as the key?

Выбранное решение

A good place to ask advice about web development is at the MozillaZine "Web Development/Standards Evangelism" forum.

The helpers at that forum are more knowledgeable about web development issues.
You need to register at the MozillaZine forum site in order to post at that forum.

Прочитайте этот ответ в контексте 👍 2

Все ответы (1)

more options

Выбранное решение

A good place to ask advice about web development is at the MozillaZine "Web Development/Standards Evangelism" forum.

The helpers at that forum are more knowledgeable about web development issues.
You need to register at the MozillaZine forum site in order to post at that forum.