Jump to content

input type file (noob question, but I can't find answers)


richrock

Recommended Posts

Maybe I don't ask questions right:

 

<input type="file" /> - can I do the following:

 

Set a value="filename"?

 

Stop the input from stripping location data - eg : C:/Documents and Settings/<user>/Pictures/image.jpg becomes image.jpg.  I may need to reinsert this value using php and it's stripping the complete file url.

 

Assign a separate class for the browse button - actually are there any settings for it at all?

 

Sorry if these sound dull/noob, but googling for me returns stuff about ASP, Java and I just want plain html answers so I can import my php to it.  ::)

Link to comment
Share on other sites

Set a value="filename"?

 

No. The field is read only. You cannot set it with HTML or javscript. Only the browser's file dialog box can set it.

 

Stop the input from stripping location data -

 

No. Only the file name portion is submitted and since there is no way for you to set the value, it does not matter.

 

Assign a separate class for the browse button

 

AFAIK - the only way to style the file browse button is to make it invisible and overlay it with your own button that you can style.

Link to comment
Share on other sites

Since resubmitting a form that contains filled-in file fields causes those files to be re-uploaded each time the form is submitted, you might want to separate the process into more than one form or process and save any uploaded files and not enable the file fields in the form if you need to have the visitor correct some of the other fields.

Link to comment
Share on other sites

Exactly what I was thinking - I have two forms, one which uploads a couple of images (album art) and then the next one uploads the mp3's (music site).  They can then go back and upload alternative art (I guess) but it's mainly if there is a typo in the title/desciption, etc

 

Cheers.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.