|
Posted by Johnny on 12/31/07 00:13
On Sun, 30 Dec 2007 12:04:21 +0200, "Jukka K. Korpela"
<jkorpela@cs.tut.fi> wrote:
>Scripsit Johnny:
>
>> I need some help guys. I'm trying to modify a working MIDI ringtone
>> uploader (HTML code) to use radio buttons rather than the standard
>> "<INPUT type=>" file selector
>
>You cannot.
>
>> so the user doesn't have to browse and
>> choose from hundreds of MIDI files or manually type the MIDI filename
>> into the input box.
>
>File input is awkward, the way it has been implemented in browsers. But
>that's what you need to play with, unless you want to try something
>difficult using client-side scripting, where you will probably encounter
>serious problems classifiable as "security settings".
>
>> How do I replace this:
>>
>> <INPUT type=file name=file>
>
>You don't.
>
>> With FOUR simple radio buttons like this:
>>
>> <input type="radio" name="song" value="song1.mid">
>> <input type="radio" name="song" value="song2.mid">
>> <input type="radio" name="song" value="song3.mid">
>> <input type="radio" name="song" value="song4.mid">
>
>That's just controls for selecting between four alternatives and
>resulting in data like song=song1.mid added to the form data set. There
>is no association with any files in the user's system. The data is just
>a string of characters. Naturally, when the server receives it, it has
>no way of using the data to access files in the user's system.
>
>File input works in a different way: the browser copies the _content_ of
>the selected file into the form data (possibly together with its file
>name, which is usually irrelevant to the server),
>
>> When I replace <INPUT type=file name=file> with the above radio
>> buttons and try it out the server returns this error: "Upload Failed,
>> Please Pickup a valid audio file".
>
>No wonder. No audio file was sent.
>
>> But the files are VALID they work fine using <INPUT type=file
>> name=file> but not with the radio buttons. What am I missing here?´
>
>The idea of file input. See my dusty old page on it:
>http://www.cs.tut.fi/~jkorpela/forms/file.html
>
>> The
>> MIDI's are in the same directory as the HTML file, I even tried
>> changing the radio button values to the "Exact" file location ie:
>> value="c:/midi/song1.mid" and it still doesn't work.
>
>It's not supposed to work. Such a string is still just a string. No
>software involved tries to interpret it as any kind of file name. If the
>server tried to do that, what good would it do to access _is_ C disk (if
>any)? Accessing the user's C disk would involve a horrendous security
>problem (even if such access from server to client would be limited to
>read-only).
>
>> I'm willing to use a drop down box instead
>
>Not possible either.
Thanks Jukka your explanation makes sense and your web site was
fantastic reading. I learned a lot. Thanks again.
Navigation:
[Reply to this message]
|