# \[PHP-AS\] File upload without form?

**URL:** <https://forum.kirupa.com/t/php-as-file-upload-without-form/78640>\
**Category:** programming\
**Created:** [February 6, 2005, 8:08pm UTC](https://forum.kirupa.com/t/php-as-file-upload-without-form/78640 "2005-02-06T20:08:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![grappaFruit](https://avatars.discourse-cdn.com/v4/letter/g/43a26b/32.png) [@grappaFruit](https://forum.kirupa.com/u/grappaFruit)\
**Post date:** [February 6, 2005, 8:08pm UTC](https://forum.kirupa.com/t/php-as-file-upload-without-form/78640/1 "2005-02-06T20:08:33Z")

</div>

I wonder…

Uploading a file with php is fairly simple, using a html form:

```auto
<html>
<head>
	<title>HTML Form</title>
</head>
<body>
	<form name="upload" method="post" action="up.php" enctype="multipart/form-data">
	 <input type="file" name="Image"><br>
	 <input type="submit" value="Upload Image">
	</form>
</body>
</html>

```

```php
<?php
copy ($_FILES['Image']['tmp_name'], $_FILES['Image']['name']) or die ('Could not upload');
?>

```

The problem: I want the upload to be triggered from AS, without using the form, thus, making PHP prompt the “browse…” window directly…

This is possible with javascript, but also means brower-hell.

```auto
<form method="POST" enctype="multipart/form-data" name="form1">
<input type="file" name="F1" size="20" style='display: none;'>
</form>
<SCRIPT LANGUAGE=JavaScript>
document.form1.F1.click();
</script>

```

Can it be triggered directly from PHP?

$apr=‘Cheers’;  
echo $apr;
