How to create a solution that limits user storage in an app?

Asked
Active3 hr before
Viewed126 times

5 Answers

create
90%

I can't figure out a good solution for limiting the storage amount a user may access with his files.,The language used is PHP, but I guess the solution isn't depended on the scripting language., How can an NPC replace some pages of a book with different pages, without leaving a trace of manipulation? ,This also makes it easy to show a list of files sorted in a variety of ways, allowing a user close to their limit to select some files for removal.

Don' forget about OS solutions. If the files are stored in a "user" specific directory, then you can use the OS to find the disk spaced used in that directory. A Linux solution would something like this:

$dirSize = explode("\t", `du -ks $userDir`); // Will return an array of size, dirName
if ($dirSize[0] > MAX_DIR_LIMIT) print "USER IS OVER QUOTA";
88%

I can't figure out a good solution for limiting the storage amount a user may access with his files.,In the application users are allowed to upload a limit amount of files. The limitation is based on total file size. I.e. a user might be allowed to store 50 Mb on the server.,The language used is PHP, but I guess the solution isn't depended on the scripting language.,I am building a user registration workflow for my JavaScript/PHP website. Once the user registers, they are added into a database (with an inactive status). The...

Keeping track of how much space has been used should be straightforward - with each upload you could store the space used in another table. The PHP filesize() function will tell you the size of a file on disk. Use a SUM() SQL query to get the total size of all the files uploaded by each user, and compare it against their quota limit.

filesize()
load more v
72%

Request location permissions,Allocation data access functions,Migrate to location and context APIs,For more information about data storage, consult the following resources.

Apps themselves are stored within internal storage by default. If your APK size is very large, however, you can indicate a preference within your app's manifest file to install your app on external storage instead:

<manifest ... android:installLocation="preferExternal">
   ...
</manifest>
65%

1 Apps and storage quotas are per App Service plan unless noted otherwise.,A maximum of 30 Azure AD custom roles can be created in an Azure AD organization.,Naming rules and restrictions for Azure resources,Any number of Azure AD resources can be members of a single group.

6 These resources are constrained by physical resources on the dedicated instances (the instance size and the number of instances).

7 If you scale an app in the Basic tier to two instances, you have 350 concurrent connections for each of the two instances. For Standard tier and above, there are no theoretical limits to web sockets, but other factors can limit the number of web sockets. For example, maximum concurrent requests allowed (defined by maxConcurrentRequestsPerCpu) are: 7,500 per small VM, 15,000 per medium VM (7,500 x 2 cores), and 75,000 per large VM (18,750 x 4 cores).

maxConcurrentRequestsPerCpu
load more v
75%

You can request persistent storage for your site to protect critical user or application data.,The File System Access API was designed to make it easy for users to read and edit files on their local file system. The user must grant permission before a page can read or write to any local file, and permissions are not persisted across sessions.,Here's a general recommendation for storing resources:,There are many different options for storing data in the browser. Which one is best for your needs?

if (navigator.storage && navigator.storage.estimate) {
   const quota = await navigator.storage.estimate(); // quota.usage -> Number of bytes used.  // quota.quota -> Maximum number of bytes available.  const percentageUsed = (quota.usage / quota.quota) * 100;  console.log(`You've used ${percentageUsed}% of the available storage.`);  const remaining = quota.quota - quota.usage;  console.log(`You can write up to ${remaining} more bytes.`);}
load more v

Other "create-undefined" queries related to "How to create a solution that limits user storage in an app?"