Skip to main content
Inspiring
June 7, 2006
Answered

specify folder for cfinput type file to start in

Anybody know if there's a way when using <cfinput type="file"...> to specify the folder the file browser starts in?

Better yet (and what I REALLY want to do), is there a way to simply specify the file name used by CFFILE by concatenating path + filename + doc extension, ie:

<cfset form.photo = "source_path" & form.file_name_entered_by_user & ".jpg" >

and then:

<cffile action = "upload"
fileField = "form.photo" .....

This would mke things much easier for the users.
    This topic is closed to new replies. Start a new post to keep the conversation going.
    SafariTECHCorrect answer
    Inspiring
    June 7, 2006
    I'm pretty sure no on both accounts. Primarily for security reasons.

    FILE Fields require the user to interact with their computer and make a consious decision as to what they choose. The start location depends on where they last saved or loaded files to during upload or download operations via the OS ... the OS controls this functionality, not your web page. If people could program pages to start somewhere they could try and trick users into supplying files that would impede their computer's security. In addition, how do you suppose you know where they have stored the file they are uploading?

    CFFILE UPLOAD requires a Multi-Part user form to submit for upload, and the field sent to the command must be a file field. It cannot be done through straight programming. Again this is a security issue, otherwise anyone could program a web page to steal files off a computer w/o the user knowing, and that would be a huge legal and security problem.

    2 replies

    SafariTECHCorrect answer
    Inspiring
    June 7, 2006
    I'm pretty sure no on both accounts. Primarily for security reasons.

    FILE Fields require the user to interact with their computer and make a consious decision as to what they choose. The start location depends on where they last saved or loaded files to during upload or download operations via the OS ... the OS controls this functionality, not your web page. If people could program pages to start somewhere they could try and trick users into supplying files that would impede their computer's security. In addition, how do you suppose you know where they have stored the file they are uploading?

    CFFILE UPLOAD requires a Multi-Part user form to submit for upload, and the field sent to the command must be a file field. It cannot be done through straight programming. Again this is a security issue, otherwise anyone could program a web page to steal files off a computer w/o the user knowing, and that would be a huge legal and security problem.

    Translate
    RichardGAuthor
    Inspiring
    June 7, 2006
    Glen,

    Darn, this makes perfect sense.

    Thanks very much!

    Richard
    Translate