Closed TurboCheetah closed 6 years ago
Fixed.
EDIT: The issue above. Not the following issue:
Now I get URL: Sorry, there was a problem uploading your file. (Ensure your directory has 777 permissions)
. I gave the directory the permissions and I still get it.
Edit: And my upload_max_filesize
post_max_size
are both set to 150M
Bump
@JoeGandy @DJkikisa
config.php:
<?php
return array(
'secure_key' => 'redacted',
'output_url' => 'https://i.redacted/',
'redirect_url' => 'redacted',
'allowed_ips' => '',
'page_title' => 'Turbo File Host',
'heading_text' => 'Turbo File Host',
);
?>
upload.php:
<?php
$config = include('config.php');
$key = $config['secure_key'];
$uploadhost = $config['output_url'];
$redirect = $config['redirect_url'];
if ($_SERVER["REQUEST_URI"] == "/robot.txt") { die("User-agent: *\nDisallow: /"); }
if (isset($_POST['key'])) {
if ($_POST['key'] == $key) {
$parts = explode(".", $_FILES["d"]["name"]);
$target = getcwd() . "" . $_POST['name'] . "." . end($parts);
if (move_uploaded_file($_FILES['d']['tmp_name'], $target)) {
$target_parts = explode("", $target);
echo $uploadhost . end($target_parts);
} else {
echo "Sorry, there was a problem uploading your file. (Ensure your directory has 777 permissions)";
}
} else {
header('Location: '.$redirect);
}
} else {
header('Location: '.$redirect);
}
?>
Edit: It seems to work, but only gives me my domain and not a url to an image.
Looks like mistake in ShareX Configuration part. Since I just tested and when removed name in ShareX it returned me only link with file extension. So redo ShareX Configuration Step 5 and test again :)
Still not working @DJkikisa...
EDIT: Image and I have every file in my root directory (i
). I moved the contents of u/
there aswell.
<?php
$config = include('config.php');
$key = $config['secure_key'];
$uploadhost = $config['output_url'];
$redirect = $config['redirect_url'];
if ($_SERVER["REQUEST_URI"] == "/robot.txt") { die("User-agent: *\nDisallow: /"); }
if (isset($_POST['key'])) {
if ($_POST['key'] == $key) {
$parts = explode(".", $_FILES["d"]["name"]);
$target = getcwd() . "/" . $_POST['name'] . "." . end($parts);
if (move_uploaded_file($_FILES['d']['tmp_name'], $target)) {
$target_parts = explode("/", $target);
echo $uploadhost . end($target_parts);
} else {
echo "Sorry, there was a problem uploading your file. (Ensure your directory has 777 permissions)";
}
} else {
header('Location: '.$redirect);
}
} else {
header('Location: '.$redirect);
}
?>
Thanks!
Error: Message: Too many automatic redirections were attempted.
Request URL: https://redacted/upload.php
Stack trace: at System.Net.HttpWebRequest.GetResponse() at ShareX.UploadersLib.Uploader.SendRequestFile(String url, Stream data, String fileName, String fileFormName, Dictionary2 args, NameValueCollection headers, CookieCollection cookies, ResponseType responseType, HttpMethod method, String contentType, String metadata)