• Log in or sign up for an account here: https://www.sythe.org/login

Image Hosting.

Synful

Dragon Slayer

Banned
Joined
May 24, 2012
Sythe Gold
0
Messages
441
Im looking for a simple image hosting software,

Im new to websites ect and looking for something very basic where people can Upload an image from the computer to there gallery and then from that gallery post it on forums ect.
 
PHP Shit Show 2k26
Have you tried Google?
 
There so much. You should have google'd it.

tinypic
photobucket

to name a few.
 
Sythe's 10th Anniversary
Two Factor Authentication User
MushyMuncher
Member of the Month Winner
Easter 2015
Discord Verified
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.

Put this form wherever you want it.

Code:
<form action="pictureupload.php" method="post" enctype="multipart/form-data">
<input type="file" name="upload" value="" required="required" />
<input type="submit" value="" />
</form>

Make a file called pictureupload.php and put this in it.

PHP:
					$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">'; }

This was back a long time ago though, and echoing meta refresh isn't really good practice. You should look up how to use PHP header redirects and use those instead in those places.

Edit:

So you should replace any of this:

Code:
echo '<META http-equiv="refresh" content="0; URL=pagenamehere.php">';

With this:

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?
 
Sythe's 10th Anniversary
Two Factor Authentication User
MushyMuncher
Member of the Month Winner
Easter 2015
Discord Verified
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?
 
Simple and somewhat flawed unfortunately, but usable.

I'll take a crack at it, what is your web host like? Free/shared or VPS?

Umm, Hostgator.com is where I bought it lol.


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?

Yeah, Its good when people post stuff like you did I find it easy to learn stuff when I have it in front of me. So thanks very much =)
 
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?

PHP:
chmod($target_path, 0777);
You allow files to be executed, 664 would be a more appropriate permission for a file that is simply going to be read.

PHP:
$safe_extensions = array();
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).



Just some security issues to be mindful of.
 
Sythe's 10th Anniversary
Two Factor Authentication User
MushyMuncher
Member of the Month Winner
Easter 2015
Discord Verified
PHP:
chmod($target_path, 0777);
You allow files to be executed, 664 would be a more appropriate permission for a file that is simply going to be read.

PHP:
$safe_extensions = array();
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).



Just some security issues to be mindful of.

Ah, thanks for that. I didn't really think of it.

Hopefully you can write a new one for Synful then.
 
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.
 
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
 
Just an idea for you, since it seems that your programming knowledge is limited, use a cms for your site. not detracting from what jazz is doing, but you'll be able to find a "plugin" that will your visitors to upload images, but with a cms you will also be able to do the things you probably cant atm, e.g. seo, allow for people signing up, for private access to galleries, etc etc etc. So for something that would cost you a few hundred quid, you could pretty much do yourself in a day for free.

As for a cms to use, if you wish to, I'm biased and always say wordpress, because it suits me best but joomla, drupal etc would work very well for this type of site(presuming you want to spam it out with ads)

Also with "some" experience in this type of website, make sure you have a disclaimer when people upload stuff, otherwise copyright is your problem = bad thing.
 
thanks jazz looks really really good so far =)
 
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?
 
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?

its perfect man, its exactly what Im after. Thanks very very much. =)
 
Runescape Gamblingrunescape gambling
Back
Top