I tried.....
if(istype(".wav"))
But nothing....any idea's?
ID:171231
Oct 23 2004, 2:17 pm (Edited on Oct 23 2004, 2:30 pm)
|
|
How do you put it so it says if it is a wav or midi file?
I tried..... if(istype(".wav")) But nothing....any idea's? |
In response to Gazoot
|
|
myfile=file("mysong.wav") Just as Gazoot said. Here's an example with a neat feature to make the song wait for the current song to end! NOTE: This *can* still be circumvented by any player. All the person has to do is rename the .WAV file to a .MID file. Heck, even myfile.mid.wav would work! I'd suggest using dd_hassuffix(), in the Deadron TextHandling library to get some more additional security, but that even doesn't stop them. |
In response to Phoenix Man
|
|
Phoenix Man wrote:
NOTE: This *can* still be circumvented by any player. All the person has to do is rename the .WAV file to a .MID file. Heck, even myfile.mid.wav would work! I'd suggest using dd_hassuffix(), in the Deadron TextHandling library to get some more additional security, but that even doesn't stop them. Ah, he's using it for a file sharing/upload utility! Ok, that sure calls for some extra security. :) Here's a couple of functions I wrote that tests if the file is really a Midi or WAV, and also a filesize tester: #define MIDI_SIZE_LIMIT 200 // Max 200k Midi files And how to use it? Here's a very basic file upload system verb. It's using fcopy() to prevent cluttering up the .rsc file: mob This must certainly be expanded to having different file areas for each user, etc... Well, hope it can be useful to anyone. [edit] Note that the #defines must be above the mob declaration for the code to work. /Gazoot |
In response to Gazoot
|
|
On a sidenote, do you know a website that has more of the file type headers?
|
If you're always going to use .wav and .mid as extension, use findtext().
/Gazoot