<input type="file"> will open a file open dialog when clicked.
I want to open the same file open dialog, with the button only (no input text) and with Open text on the button (not Browse) - any ideas?

What is the purpose of just using the button to browse? There doesn't seem to be any logic in it to me. The only real reason is to upload.

Maybe i'm missing something...
Sorry

Member Avatar for diafol

The file field is not a button + text input field - it's one thing. Using a button to open the dialog box - why? The file field does more than just store a filename. Sorry if you knew that already.

However, have a look at this: http://valums.com/wp-content/uploads/ajax-upload/demo-prototype.htm#

The file field is not a button + text input field - it's one thing. Using a button to open the dialog box - why? The file field does more than just store a filename. Sorry if you knew that already.

However, have a look at this: http://valums.com/wp-content/uploads/ajax-upload/demo-prototype.htm#

This is what I want, but is there simpler a way to implement it without the prototype/ajax stuff?

Member Avatar for diafol

This is what I want, but is there simpler a way to implement it without the prototype/ajax stuff?

Don't know. I don't think the prototype stuff is too complex. You're asking the thingummy to do a lot (open 'open dialog', attach file, upload file, report when successful).

Don't know. I don't think the prototype stuff is too complex. You're asking the thingummy to do a lot (open 'open dialog', attach file, upload file, report when successful).

Actually I don't want to upload the file to the server, I want the client code to process it.
Now I understand that native Javascript can not read/write files from the user's computer. Does the prototype example work with OS / platforms other than windows?

Member Avatar for diafol

prototype is designed to be os independent. jquery the same. You'll need to use ajax I think to get hold of files.

I think you'll need an invisible file field anyway to open the old dialog. Add a button or clickable image or whatever to act as a pseudo file field (linked via js to file field). See the link I gave you for the source code. In fact, it seems that this script does what you want as the actual uploading has been disabled. Result!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.