PHP Upload

Issue

Not sure on how to configure your website to have the function to upload files

Symptoms

None

Cause

Lack of knowledge with PHP upload

Workaround

cpanelID – Cpanel Login ID
uploadfolder – Folder name where the file will be uploaded to.

Note:
Remember to give write permission to the uploadfolder.

<?php

if (isset($_POST[‘btnsubmit’]))
{
$target_path = “/home/cpanelID/public_html/uploadfolder/”;

$target_path = $target_path . basename( $_FILES[‘uploadedfile’][‘name’]);

if(move_uploaded_file($_FILES[‘uploadedfile’][‘tmp_name’], $target_path))
{
echo “The file “. basename( $_FILES[‘uploadedfile’][‘name’]). ” has been uploaded”;
}
else
{
echo “There was an error uploading the file, please try again!”;
}

}

echo $target_path;
?>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Untitled Document</title>
</head>

<body>
<p>&nbsp;</p>
<form action=”” method=”post” enctype=”multipart/form-data” name=”form1″ id=”form1″>
<p>
<input name=”uploadedfile” type=”file” id=”uploadedfile” />
</p>
<p>
<input name=”btnsubmit” type=”submit” id=”btnsubmit” value=”Upload File” />
<input type=”hidden” name=”MAX_FILE_SIZE” value=”100000″ />
</p>
</form>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>

Additional Information

If you are unable to resolve the problem above, kindly issue a ticket to Support Team.

Updated on March 14, 2019

Was this article helpful?

Related Articles

Leave a Comment

Need Help?
Submit a ticket to us and let our professional team assists you

Support Billing Sales
Support
Billing
Sales