Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upload file not working

Tags:

html

php

I have the following page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="/css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
Click Browse and choose a file from your PC<br /><br />
<form method="POST" action="_URL_" enctype="multipart/form-data" name="IMGform">
<input type="file" name="image_upload"><br /><br />
<input class="button" type="Submit" value="Change Image">
<input type="hidden" name="add_image" value="true">
</form> 
</body>

It simply produces nothing when I add a file to upload.

var_dump($_POST) only produces:

array(1) { ["add_image"]=> string(4) "true" } 
like image 968
StudioTime Avatar asked Jun 28 '26 00:06

StudioTime


1 Answers

Files are available through $_FILES, not $_POST.

See the documentation for further information.

like image 72
Sampson Avatar answered Jun 29 '26 12:06

Sampson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!