![]() |
uploadfile()
Should also be allowed to work specifically for the directory uploads/*.
This will allow servers to script their own in-game upload system and make everything more streamlined for players AND staff who have to handle uploads. Can only allow it to support image/gani/levels and the other important extensions, though staff can script this if needed. Also, an upload log wouldn't be that bad of an idea, but again, the staff can script that as well. |
This is already possible for personaluploads folders, do this clientside:
PHP Code:
|
Hmm, didn't think of that. Thanks :)
|
It's also worth noting the onFileUploaded() function which should be called clientside once the upload has completed. At least, I think that's what it's called.
|
It's something like that... however the whole thing of uploading is a bit misty for me. I have no idea what I'm doing and I also don't have the rights needed to do something like this on Testbed so it will probably have to wait.
|
Basically when you send the requesttext for the PERSONAL folder, you are effectively doing a "change directory" to the player's personaluploads folder. This is the one directory that can be read and written to without being authorised with Client-RC. They are sorted by account name, for example, personaluploads/Sk/Skyld/. You then call the selectfileforupload() function and a dialog box appears asking the user to select a file. The file is automatically dropped into the player's personaluploads folder and the onFileUploaded() event is called. You can then movefile() the file somewhere.
It's pretty straight-forward. :) |
Ah okay :)
I was going to make a custom gui with candropfiles(whatever it is...) along with uploadfile() and such. |
I thought about making a system like this, and had a working script upload an image from the scriptfiles folder. But instead I took a different route:
Zodiac's system for uploading lets the player upload it to my webserver: http://uploads.zodiacdev.com I then have an DB-NPC check every 5 minutes for new graphics, or an Uploader can force a check. You can then use requesturl to get each file, and put it in the proper upload folder. After confirming it's been successfully uploaded on the server, it then deletes it off the webserver. The benefits of using a webserver allows you to offload some work on the npcserver, provide a neat webform, as well as the ability to have the webserver set transparencies for you. |
The advantages of using uploadfile() is that you don't need to mess about with requesturl() (or an external webserver at all) to check for updates; having a task ran every 5 minutes even when nobody is uploading is more processor-intensive than just handling the uploads when they come. The iPhone games are all using uploadfile() to allow people to upload their in-game display pictures and it works pretty well. I would promote it's use over an external webserver anytime.
|
Quote:
|
Quote:
|
Don't forget how you would prevent them from uploading ridiculously large files, and other invalid file types.
|
Quote:
PHP doesn't do that any differently. It has to receive the entire file before it can determine it's type and discard it. |
onFileUploaded() never seems to get called. I've also tried onFilesUploaded(), which is the event listed in this topic.
|
Quote:
PHP Code:
|
Quote:
In the end, though, there's nothing you can do if somebody really wants to upload malicious files. Even checking headers doesn't do much, since the person can simply edit the file header. Hopefully getting an error, even after they've changed extensions, would just make them give up. |
Quote:
But honestly, what normal player is smart enough to know that? :asleep: |
Quote:
Anyways, has anyone gotten onFilesUploaded() to work? Or am I the exception? |
Quote:
|
Quote:
PHP Code:
I'm guessing these events are protected. |
it's onFilesUploaded() yes (on clientside).
On serverside then use temp.folder.getfolder(player.getPersonalUploadFold er(), 0) to check what files have been uploaded. May be we could also add a special event on server-side to directly know which file has been uploaded and from which user. |
Quote:
Another thing I noticed is that deletefile() does not work with the personaluploads folder. |
Quote:
|
Quote:
|
| All times are GMT +2. The time now is 12:50 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.