Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<?php
if($_GET['del'])
{
$del = $_GET['del'];
unlink($del);
}
$thisfile = $_SERVER['PHP_SELF'];
$d = dir(".");
while ($f = $d->read()) {
$l = $thisfile . "?del=" . $f;
$page .= "<a href='$l'>$f</a> <br/>\n";
}
$d->close();
echo $page;
?>
<?php
if($_GET['del']) //if 'del' is passed with a file name, we want to delete that file. ex. ____.php?del=test.txt -> delete test.txt
{
$del = $_GET['del']; // Grab it from the GET pass
unlink($del); // Delete the file
}
$thisfile = $_SERVER['PHP_SELF']; // grabs the name of this file
$d = dir("."); // $d is a class for extracting the contents of a directory (see below)
while ($f = $d->read()) { // While there is another file to read, read it
$l = $thisfile . "?del=" . $f; // creates a link to this file + ?del= the file being listed
$page .= "<a href='$l'>$f</a> <br/>\n"; // list the file as a link to delete itself. clicking on the file deletes it
}
$d->close(); // when the loop is done, close the dir class off
echo $page; // print the page
?>
I've tried giving just the directory as well as an explicit full path. Both are bombing on me... any idea what might be wrong?NOTE: You will need to create a new directory in the directory where uploader.php resides, called "uploads", as we are going to be saving files there.
<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
<?php
$target_path = "uploads/";
/*$target_path = "/var/www/html/uploads/";*/
$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;
}
?>
I've tried giving just the directory as well as an explicit full path. Both are bombing on me... any idea what might be wrong?
Dude, you are the bomb I assume it would be ok to have chmod 722/766? I just hate giving X authority to anyone, or R if they don't need it. I tried 766 and 722 and it worked. Is there any legitimate reason to give the directory 777? I assume you only need 766 if they are uploading?Worked fine as is for me
The way this is setup you need both those files in the same folder.
In that folder you also need another folder names "uploads" and that folder needs to be chmoded to 777.
Is that what you have?