Use a default value for file in upload script

Posted on 2007-08-01
Last Modified: 2008-03-06
This is part of my php script.

<form action="<?=$this_script?>" method="post" enctype="multipart/form-data">
File: <input type=file name="file" size=30><br>
<input type=submit name="submit" value="Upload File"></form>
<a href="<?=$home_page?>">Return to the Home Page</a>

How can I have a default value set for the file instead of having to browse to it every time?
Question by:Grant Fullen
    LVL 34

    Expert Comment

    by:Terry Woods
    Wouldn't it just be this?

    <input type=file name="file" value="C:/directory/filename.doc" size=30>
    LVL 17

    Expert Comment

    There are no way to access the browse but you can try another way

    take a look at


    Author Comment

    by:Grant Fullen
    I tried the value= thing already and I'm pretty sure it didn't work (as in the file didn't upload).

    All I can find in that link is how to change the look of it.
    LVL 51

    Accepted Solution

    most browser deny to set the value= for <input type="file" ...> for security reason, obviously ..

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now