Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Radio Buttons used for FileUploaders?

Reply
Thread Tools

Radio Buttons used for FileUploaders?

 
 
Johnny
Guest
Posts: n/a
 
      12-30-2007
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 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.


How do I replace this:

<INPUT type=file name=file>

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">

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".

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
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. Any suggestions?
I'm willing to use a drop down box instead but I'd need to see some
sample code of how that's done.
 
Reply With Quote
 
 
 
 
Neredbojias
Guest
Posts: n/a
 
      12-30-2007
Well bust mah britches and call me cheeky, on Sun, 30 Dec 2007 05:26:25 GMT
scribed:

> 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 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.
>
>
> How do I replace this:
>
> <INPUT type=file name=file>
>
> 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">
>
> 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".
>
> 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
> 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. Any suggestions?
> I'm willing to use a drop down box instead but I'd need to see some
> sample code of how that's done.


Using radio buttons for file uploads in forms doesn't work because
currently only inputs can be "file select" (upload) elements.

--
Neredbojias
Riches are their own reward.
 
Reply With Quote
 
 
 
 
Jukka K. Korpela
Guest
Posts: n/a
 
      12-30-2007
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.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 
Reply With Quote
 
Johnny
Guest
Posts: n/a
 
      12-31-2007
On Sun, 30 Dec 2007 12:04:21 +0200, "Jukka K. Korpela"
<(E-Mail Removed)> 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.
 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      12-31-2007
In article <(E-Mail Removed)>,
Johnny <(E-Mail Removed)> wrote:

> Thanks Jukka your explanation makes sense and your web site was
> fantastic reading. I learned a lot. Thanks again.


If you read more of him, you would not quote so unnecessarily.

--
dorayme
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Created Radio Buttons displaying as if they were conventional buttons Dr. Leff Javascript 3 10-15-2007 09:47 PM
Created Radio Buttons displaying as if they were conventional buttons Dr. Leff Javascript 3 10-15-2007 05:18 AM
ASP.NET Reset Radio Button in a group of Radio Buttons Scott D Johnson ASP .Net 1 09-27-2006 10:38 PM
2.0 , does it fix BUG: Radio Buttons Are Not Mutually Exclusive When Used in a Repeater Server Control sloan@ipass.net ASP .Net 0 01-07-2006 12:17 AM
Has 2.0 Fixed this 1.1 bug? Radio Buttons Are Not Mutually Exclusive When Used in a Repeater Server Control sloan@ipass.net ASP .Net 0 01-06-2006 09:23 PM



Advertisments