SMFHacks.com
SMF Gallery Pro => Support => Feature Requests => Topic started by: nitins60 on January 15, 2007, 01:52:59 am
-
I really need this feature! It's one of the vB mods! (http://www.vbulletin.org/forum/search.php?searchid=4227447)
* it displays a field to insert external file link
ex: www.your.com/handy.zip
* then it simply upload to server, like an attachment and displays in post!
<?php
$defaultDest = "./upload";
$password = "";
$os = "1";
$submit="hah!";
echo "<form method=\"POST\" action=\"$PHP_SELF\">";
echo "<fieldset>\n<legend>http uploader</legend>\n";
echo "<label for=\"file\">File Url</label><br>";
echo "Example: http://bla.com/file.ext<br>";
echo "<input type=\"text\" name=\"file\" id=\"file\" tabindex=\"1\" value=\"\"><br>";
echo "<label for=\"new\">New file name</label><br>";
echo "Example: file.ext<br>";
echo "<input type=\"text\" name=\"new\" id=\"new\" tabindex=\"2\" value=\"\"><br>";
if ($password) {
echo "<label for=\"password\">Password</label><br>";
echo "<input type=\"password\" name=\"password\" id=\"password\" tabindex=\"3\" value=\"\"><br>";
}
echo "<p><input name=\"submit\" type=\"submit\" id=\"submit\" value=\"submit\"></p>";
echo "</fieldset>\n</form>";
$submit = $_POST['submit'];
if($submit) {
if($password) {
if ($_POST['password']!=$password) {
echo "Password incorrect!";
} else {
$access = "09023578353";
}
} else {
$access = "09023578353";
}
if($access=="09023578353") {
if($os==2) {
$slash="\\";
} else {
$slash="/";
}
$file = $_POST['file'];
$newfilename = $_POST['new'];
if($_POST['otherdest']) {
$dest = $_GET['otherdest'];
} else {
$dest = $defaultDest;
}
$ds = array($dest, $slash, $newfilename);
$ds = implode("", $ds);
if (file_exists($ds)) {
echo "<p>File already exists! <br>\n Adding random digits to beginning of filename.</p>\n";
$ds = array($dest, $slash, rand(0,9999), $newfilename);
$ds = implode("", $ds);
}
echo "<p>New destination $ds</p>\n";
if (!copy($file, $ds)) {
echo "<p>Was unable to copy $file <br>\n See if your path and destination are correct.</p> \n";
} else {
echo "<p><strong>Copy successful!</strong></p> \n";
}}}
?>
i added $password for security reasons, when i use in normal web pages! It's not necessary, if it's possible to use n SMF