Skip to content Skip to sidebar Skip to footer

Set A Default File Name/directory For Upload On Web Form By Modifying The Html

I use this upload form all of the time and use the same file name each time. I wonder if there is a way to set the file name in a form by changing the code and saving the file loca

Solution 1:

PHP Code: (in mibdata.php)

$target_path = "/path/to/save/file/filename.ext";
if(isset($_FILES['uploadedfile'])){
   move_uploaded_file($_FILES['uploadedfile']['tmp_name'],$target_path);
}

Make sure that the target_path is writable by server.

Solution 2:

You'll also have to use something like PHP as a Script so you can move your uploaded file from the Webserver's temp-directory to somewhere where it can be saved persistent.

Look at this Tutorial for example.

Post a Comment for "Set A Default File Name/directory For Upload On Web Form By Modifying The Html"