-
-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A way to upload files to a server #2489
Comments
This is really clever! I use the old fashioned file uploading way (player places file in downloaded resource folder and gives file name) on various systems, this would do wonders!! |
Such function could open modal to ask user if s/he actually want to open file explorer. Maybe even with optional tickbox like "Remember this choice for current server". Drag & drop support would be also cool (at least for script development, probably not much for ordinary gameplay). |
Chrome, Firefox, Safari and other popular browsers already support the experimental file and directory entries API, described here, which allows websites to let their users upload files and directories, and is defined in a way that does not let websites know any more data than necessary. We could take inspiration from that API to implement this feature. Alternatively, as MTA bundles CEF, which is based on Chromium, the same browser engine that powers Chrome, maybe it's already possible to work around the lack of this feature by using it? I've never tested file uploads in MTA CEF, but that could be another interesting angle. |
Semi-duplicate of #1953 |
Is your feature request related to a problem? Please describe.
Currently the only way you can upload files from your MTA into a server is by copying the files to one of your resources in
MTA/mods/deathmach/resources
folder or via web.MTA could have a way to let users upload files to the server. You could call a function like
requestFile
(both client-sided and server-sided) that open a GUI where you could search for any file on your system and upload it.How CS:Source's UI looks for reference.
The window needs to work similar to how
requestBrowserDomains
works. You could disable the option to upload any files to servers from the Configuration, and the function could return some value so scripters can ask the client to change this configuration in order to upload the file (similar totakePlayerScreenshot
).Servers will not be able to see the client file-tree, ever. Servers will not be able to ask for a file that is on X directory. The user should search for the file by himself. The option to upload files to a server should be disabled by default, and when changed it should pop-up a warning.
I really can't see any harm done to have this added, apart from bugs. Maybe I'm not seeing some important security issues a thing like this would bring.
Describe the solution you'd like
A function like
requestFile
to be added client-side and server-side.Client-side should upload the data of the file into a variable (like how
fileRead(file, fileGetSize(file))
would) and let the resource manage it. Maybe a callback would be needed, but I don't think it will.Server-side should do the same but on an event or callback. The server function should allow a way to select the size of the file aswell as the upload velocity, similar to
takePlayerScreenshot
.This functionality should come disabled by default and need to be enabled from Main Menu > Configuration.
Describe alternatives you've considered
Copying the file into a temporary folder would also work wonders.
If this is too risky then the alternative would be to not have this at all.
Additional context
This would come in handy for uploading of images in particular. Models could also be used for customization, but this would be harder than managing some images.
The main focus should be security. And oversight could mean the world for malicious server owners that want to harm users. I guess this is why there is no such feature like this yet.
The text was updated successfully, but these errors were encountered: