url uploader

Started on the old forum in September 2010 · view the original in the archive · old links redirect here

5 replies · 1,263 views · started 16 years ago · 1 min read

3 participants
Morfious Junior · 25 posts #1

is it possible to make url uploader in autoindex script ?? let me know how ? they say sea script support url uploading . but how?? there is no option for url uploading ..

something else Fellow · 2,296 posts #2

settings.php

<?php
defined('_ALLOWINCLUDE') or die();

// Default destination to copy files too NO TRAILING SLASH!!
// If it is complete path, file be copied there ex: /home/public_html/FOLDER (Linux), C:\htdocs\FOLDER (Windows)
// If it is just a direcotory it will be copied to that directory in directory the script is in ex: /SnatcherFolder/FOLDER
$defaultDest = 'snatched';
	/*
	More examples
	If $defaultDest = ''; it will automatically copy to the `snatched` directory inside of the script's directory.
	If $defaultDest = 'files'; it will copy to `files` directory inside of the script's directory.
	*/

// If you want a password to be required
// Remember if you don't have a password anyone can copy a file to your server!
$password = ''; 

// URL to location of snatched files WITH OUT TRAILING SLASH
$URLDest = 'http://somesite.con/snatched';

// Put a limit for file size in kilobytes (1024KB is 1MB)
// For unlimited put 0
// Example $sizelimit = 25;
$sizelimit = 0;

?>

index.php

<?php
//File Snatcher 2.7
define('_ALLOWINCLUDE',0);
include 'settings.php';
$version = '2.7';
//////////////////////////////////////////////
//Do Not Change Below Here////////////////////
//////////////////////////////////////////////
if (function_exists('curl_init'))
{
	$snatch_system = 'curl';
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<title>File Snatcher <?php echo $version; ?> - © http://somesite.con</title>
</head>
<body>

<div id="main">
<?php
$submit = $_POST['submit'];
if ($submit)
{
	if (isset($password))
	{
		if ($_POST['password'] != $password)
		{
			die('<p><strong>Password incorrect!</strong></p>');
			$error = true;
		}
	}
	
	if (!$defaultDest)
	{
		$defaultDest = 'snatched';
	}
	
	if (!file_exists($defaultDest))
	{
		mkdir($defaultDest);
	}
	
	$sizelimit = $sizelimit * 1024;
	
	$file = $_POST['file'];
	
	$uploadfile = explode('/', $file);
	$filename = array_pop($uploadfile);
	
	$newfilename = $_POST['new'];
	
	if (!$newfilename)
	{
		$newfilename = $filename;
	}
	
	if (!isset($file))
	{
		echo '<p><strong>Please enter a URL to retrieve file from!</strong></p>';
		$error = true;
	}
	
	if (!isset($newfilename))
	{
		echo '<p><strong>Please enter a new file name!</strong></p>';
		$error = true;
	}
	
	if ($error == false)
	{
		$dest = $defaultDest;
		$ds = array($dest, '/', $newfilename);
		$ds = implode('', $ds);
		$newname_count = 0;
		if (file_exists($ds))
		{
			echo '<p><strong>File already exists!</strong></p>';
			$newname_count++;
			$newfile = array($newname_count, $newfilename);
			$newfile = implode('~', $newfile);
			$newfile_ds = array($dest, '/', $newfile);
			$newfile_ds = implode('', $newfile_ds);
			while($renamed == false)
			{
				if (file_exists($newfile_ds))
				{
					$newname_count++;
					$newfile = array($newname_count, $newfilename);
					$newfile = implode('~', $newfile);
					$newfile_ds = array($dest, '/', $newfile);
					$newfile_ds = implode('', $newfile_ds);
				}
				else
				{
					$renamed = true;
				}
			}
			$newfilename = $newfile;
			$ds = $newfile_ds;
			echo '<p>New file name is <strong>'.$newfile.'</strong>.</p>';
		}
		echo '<p><strong>Copying...</strong></p>';
		if ($snatch_system == 'curl')
		{
			$ch = curl_init($file);
			$fp = fopen($ds, 'w');
			curl_setopt($ch, CURLOPT_FILE, $fp);
			curl_setopt($ch, CURLOPT_HEADER, 0);
			curl_exec($ch);
			$curl_info =  curl_getinfo($ch);
			curl_close($ch);
			fclose($fp);
		}
		else
		{
			if (!copy($file, $ds))
			{
				echo '<p>Was unable to copy <a href="'.$file.'">'.$file.'</a><br />See if your path and destination are correct.</p>';
				$copy_fail = true;
			}
		}
		
		if ($copy_fail == false)
		{
			if ($sizelimit > 0 && filesize($ds) > $sizelimit)
			{
				echo '<p><strong>File is too large.</strong>';
				unlink($ds);
			}
			else
			{
				echo '<p><strong>Copy successful!</strong></p>';
				echo '<p><a href="'.$URLDest.'/'.$newfilename.'">Click here for file</a></p>';
				if ($snatch_system == 'curl')
				{
					$size_dl = round($curl_info['size_download']/1024, 2);
					$speed_dl = round($curl_info['speed_download']/1024, 2);
					echo '<p>Downloaded '.$size_dl.'KB in '.$curl_info['total_time'].' seconds.<br />With an average download speed of '.$speed_dl.'KB/s.';
				}
			}
		}
	}
}

$self = $_SERVER['PHP_SELF'];
echo '<form method="POST" action="'.$self.'">';
echo '<fieldset><legend>File Snatcher</legend>';
echo '<label for="file">Full path to file to copy</label>';
echo '<p>Example: http://foobar.com/image.png</p>';
echo '<input type="text" name="file" id="file" size="45" value="">';
echo '<label for="new">New file name (Optional)</label><br />';
echo '<p>Example: image.png</p>';
echo '<input type="text" name="new" id="new" size="45" value="">';
if (isset($password))
{
	echo '<label for="password">Password</label>';
	echo '<input type="password" name="password" id="password" size="45" value=""><br />';
}
echo '<p><input name="submit" type="submit" id="submit" value="submit" accesskey="s"></p>';
echo '</fieldset></form>';
?>
</div>
</body>
</html>
wap4ads Developer · 68 posts #3

its uploading all file in 1.31kb size .....not copying properly

Free Advertising @ wap4ads.com

Advertise your site freely @ http://wap4ads.com

something else Fellow · 2,296 posts #4

wap4ads wrote: its uploading all file in 1.31kb size .....not copying properly

heres your answer i guess:

kiLLeR-eyEd_14 wrote: Try diz in ur .htaccess

php_value upload_max_filesize 100M
php_value post_max_size 100M
php_value max_execution_time 1000
php_value max_input_time 1000
Morfious Junior · 25 posts #5

thanks for your valueable reply could you please tell me how to use this script in autoindex

something else Fellow · 2,296 posts #6

That script copys other peoples files and puts them on to your site .... i think you are wanting to keep the files on there server ? in which case you would be wanting to make a grabber script ...... grabber script will be so different on every page you grab there is no easy way of doing it ... here is a tutorial: </t/6013-cpanel>

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close