Visualizzazione dei risultati da 1 a 5 su 5

Discussione: type=file value=???

  1. #1

    type=file value=???

    Ciao ragazzi ho un problema

    vorrei usare un input di tipo file eperò vorrei stamparci
    dentro già un immagine di default solo per 'value' non funziona
    mi spiego meglio
    quando uso

    <input type="file" value="stringa">

    all'esecuzione stringa non viene visualizzata

    potete aiutarmi?

    grazie

  2. #2
    GdR Online - http://lenar.it/
    Yesterday is history. Tomorrow is mystery.
    Today is a gift. That's why it's called the present

  3. #3
    scusa forse mi sono spiegato male:

    vorrei usare <input type="file"> che ti
    permette di caricare un file però vorrei che
    se l'utente non sceglie nessun file, ci sia
    già uno di default.
    Quindi affianco al bottone sfoglia vorrei che venisse
    visualizzato il path del file che voglio usare per default

  4. #4
    se non erro, non è possibile specificare un value di default per i campi di tipo file.

  5. #5
    ho trovato questo, ma non so di preciso:

    Setting the default filename

    The HTML 4.0 specification says that for a file input field, browsers (user agents) "may use the value of the value attribute as the initial file name". This however is usually not supported by browsers. The usual explanation is "security reasons". And indeed it would be a security risk if files from the user's disk were submitted without the user's content. It might be all too easy to lure some users into submitting some password files! But in fact RFC 1867 duly notifies this problem; in section 8 Security Considerations it says:

    It is important that a user agent not send any file that the user has not explicitly asked to be sent. Thus, HTML interpreting agents are expected to confirm any default file names that might be suggested with <INPUT TYPE=file VALUE="yyyy">.

    It also mentions (in section 3.4) that the use of value "is probably platform dependent" but then goes on: "It might be useful, however, in sequences of more than one transaction, e.g., to avoid having the user prompted for the same file name over and over again." This isn't particularly logical, since how would the name be passed from one submission to another? (The mechanism for getting the original file name would be quite unreliable for such purposes.) A more useful application could be this: Assume that your form is for reporting a problem with a particular program, say Emacs, and that program uses a configuration file with some specific name, say .emacs, so that you would very much like to get the user's config file for problem analysis. Setting the default name, if supported by the browser, might be an extra convenience to the user.

    Thus, they just failed to implement it, for no good reason. This isn't a very important flaw, however. The situations where it would make sense to suggest a default file name are rare.

    Netscape's HTML Tag Reference says, in the description of input type="file", that "VALUE=filename specifies the initial value of the input element", but no actual support to this in Netscape browsers has been reported. Similar considerations apply to the corresponding item in Microsoft's HTML Elements reference. It additionally messes things up by describing the intended meaning wrong: "Sets or retrieves the value of the <INPUT type=file>". The description links to a description of the value attribute which says: "The value, a file name, typed by the user into the control. Unlike other controls, this value is read-only." This probably relates to using the value property in client-side scripting. And in fact, one can read the value in JavaScript (and get the filename entered by the user) but setting it is unsuccessful (without an error message); the same applies to Netscape (but on Opera, even an attempt to read the value seems to confuse the browser). Note that the examples in the above-mentioned documentation do not contain an input type="file" element with a value attribute.

    However, support to file input in Opera 3.60 and later handles the value attribute in the following way:

    * the value is displayed in the box for file name input
    * that value can be edited by the user (as an alternative to using the Browse menu, which changes the content of that box)
    * however if the user submits the form so that the initial value has not been changed by the user, there will be a security alert and the user is requested to confirm the submission.
    * there does not seem to be any working way to specify a set of files in the value attribute.

    The following form contains a file input field with value="C:\.emacs". Your browser probably just ignores that attribute, but some browsers may use it to set the initial file name:

    An example of Opera's security alert in the situation discussed above:
    ! The files listed below have been selected, without your intervention, to be sent to another computer. Do you want to send these files? Destination http://yucca.hut.fi/cgi-bin/sendback.pl Form URL http://www.hut.fi/u/jkorpela/forms/filedemo.html C:\emacs OK Cancel Help

    There was a short-time bug in Opera 6 that created a security hole, which would have let authors grab users' files without their knowing, i.e. bypassing the dialogue described above.



    Questo è il link per bene:

    http://www.cs.tut.fi/~jkorpela/forms/file.html
    GdR Online - http://lenar.it/
    Yesterday is history. Tomorrow is mystery.
    Today is a gift. That's why it's called the present

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.