Have you tried Google?
There so much. You should have google'd it.
tinypic
photobucket
to name a few.
<form action="pictureupload.php" method="post" enctype="multipart/form-data">
<input type="file" name="upload" value="" required="required" />
<input type="submit" value="" />
</form>
$target_path = "/pathtoupload/";
//die($target_path);
//Owner: read/write, all else fail
chmod($target_path, 0777);
$error = false;
//size check
if($_FILES['upload']['size'] > 500000000)
{
echo '<META http-equiv="refresh" content="0; URL=errorpage.php">';
}
$safe_extensions = array(
'.jpg',
'.jpeg',
'.png',
'.gif');
//random name
$old_name = $_FILES['upload']['name'];
$new_name = md5(time());
$ext = stristr($old_name, '.');
if(!in_array($ext, $safe_extensions))
{
echo '<META http-equiv="refresh" content="0; URL=errorpage.php">';
}
$target_path = $target_path . $new_name.$ext;
if(!$error && move_uploaded_file($_FILES['upload']['tmp_name'], $target_path)) {
echo '<META http-equiv="refresh" content="0; URL=successpage.php">'; }
echo '<META http-equiv="refresh" content="0; URL=pagenamehere.php">';
header('Location: pagenamehere.php');
Here's a very simple script taken from my old website. Feel free to edit it how you want, and ask any questions here if you need help using/understanding it.
Simple and somewhat flawed unfortunately, but usable.
I'll take a crack at it, what is your web host like? Free/shared or VPS?
Simple and somewhat flawed unfortunately, but usable.
I'll take a crack at it, what is your web host like? Free/shared or VPS?
Like I said, it was pretty old, and probably from a tutorial actually. What was flawed about it though, if you don't mind me asking?
Like I said, it was pretty old, and probably from a tutorial actually. What was flawed about it though, if you don't mind me asking?
chmod($target_path, 0777);
$safe_extensions = array();
You allow files to be executed, 664 would be a more appropriate permission for a file that is simply going to be read.PHP:chmod($target_path, 0777);
You don't check the mime type being sent, only the extension. You could hide a script renamed as .jpg and run it directly (Unless you did a FORCED DOWNLOAD).PHP:$safe_extensions = array();
Just some security issues to be mindful of.
Hi Jazz if you could right me a very simple script that allows me to upload images then see the image link that would be great Im willing to pay if you could help me with this =)
Thanks very much.
Just creating a nice script for you![]()
I'll reply back when it's done
Is it shared, VPS or dedicated? Hostgator doesn't allow image hosting scripts on shared hosting.Umm, Hostgator.com is where I bought it lol.
Is it shared, VPS or dedicated? Hostgator doesn't allow image hosting scripts on shared hosting.
http://www.hostgator.com/tos/tos.php
Oh boy, here we go. Hopefully we can keep this thread civil from now on? (Both sides please)Go ahead and report me kid.
Oh boy, here we go. Hopefully we can keep this thread civil from now on? (Both sides please)
I might not be able make much progress today with work and all, but the next item on my agenda is the gallery.
Then I'll clean up the code and throw in the last bits of error checking.
Questions, comments or complaints so far?

