SRL Archive - Web Development

PHP Image Uploader


Harry

2009-11-26 19:31:21

http://harryy.us/upload/

Simple little script, was bored, and a friend requested it. Mostly based off my former file uploader.


I intentionally have the speeds limited. It will go a bit slow. The reasoning behind this being:
1) A user can't upload some huge image for use on their site, then hotlink it and (ab)use my bandwidth.
2) It makes for more stability.

I don't run this as a replacement for Tinypic, I just made it for my friends who were tired of Imageshack removing their Hentai =P





So, try it out, let me know what you think. :)

Awkwardsaw

2009-11-26 19:42:19


:>

caused

2009-11-26 19:42:25

Looking good ; D
But its still not more user friendly than imageshack & co. Cause of the captcha.
There are better ways, to avoid bots and flooding ;).

~caused

edit: hooray:


Harry

2009-11-26 19:45:23

From: caused
Looking good ; D
There are better ways, to avoid bots and flooding ;).


Do elaborate? Captchas are the best way IMO?

caused

2009-11-26 19:53:08

From: Harry
Do elaborate? Captchas are the best way IMO?


They are not, cause they're not userfriendly.

There are alot of different methods which are "save enough".

Like:
- Making an extra form, field which requires a certain input.. like "three + five = ? ". Changing that every now and than ofc.

- Limited bandwith per IP per 24 hours

- A JavaScript that generates a string which is sent with the form and validated by the php script.

- Ofcourse a file-size-limit and capping the upload-rate to 20 kb/s or so.

Just some Ideas.

~caused

Harry

2009-11-26 19:57:04

>They are not, cause they're not userfriendly.

How isn't it user-friendly to type out one or two words? :(


>Making an extra form, field which requires a certain input.. like "three + five = ? ". Changing that every now and than ofc.

Basically the same idea as a captcha, but anyone can go and get the answer and abuse :>


>Limited bandwith per IP per 24 hours

Proxies, etc.


>A JavaScript that generates a string which is sent with the form and validated by the php script.

Ew, Javascript is ugly, and it's bad to force the user to use it. Oh, and any bot can also force that I think =P


>Ofcourse a file-size-limit and capping the upload-rate to 20 kb/s or so.

I do that, but it still won't help with 'tards who think that F5ing the page and resending the data to waste my time and space; the captcha does =)

caused

2009-11-26 20:07:56

DAMN, i just wrote a suuuper huge, awesome and long reply, and pressed something, and now its lost *_* geeez… Ok, ill try to get the essence out of it now.


>They are not, cause they're not userfriendly.

How isn't it user-friendly to type out one or two words? :(

☺ If u mistype them too often, you're annoyed and destroy your keyboard, screen or computer-mouse. It also requires more time for the user than any of the methods i suggested.

>Making an extra form, field which requires a certain input.. like "three + five = ? ". Changing that every now and than ofc.

Basically the same idea as a captcha, but anyone can go and get the answer and abuse :>

☺ A long list of "questions and answers" solves this

>Limited bandwith per IP per 24 hours

Proxies, etc.

☺ Public Proxies are not good. Dedicated expensive.

>A JavaScript that generates a string which is sent with the form and validated by the php script.

Ew, Javascript is ugly, and it's bad to force the user to use it. Oh, and any bot can also force that I think =P

☺ Most bots dont compile java scripts

>Ofcourse a file-size-limit and capping the upload-rate to 20 kb/s or so.

I do that, but it still won't help with 'tards who think that F5ing the page and resending the data to waste my time and space; the captcha does =)

☺ yes, so if someone would want to kill the server, they probably could with or without captcha


Oh. and don't get me wrong : D Good effort anyways! ;)

Harry

2009-11-26 21:05:53

I suppose you're right in some cases, but in most IMO a captcha doesn't really hurt. ReCAPTCHA is very lenient on answers. You can totally slaughter a word, but as long as it is similar, it usually accepts it.

MylesMadness

2009-11-26 21:08:42

From: Harry
I suppose you're right in some cases, but in most IMO a captcha doesn't really hurt. ReCAPTCHA is very lenient on answers. You can totally slaughter a word, but as long as it is similar, it usually accepts it.

Well, because recaptcha only checks the letters it knows it true, since the whole point behind it is to OCR books that can't already be done.

Harry

2009-11-27 00:47:59

I updated it =D

I use some fancy Javascript (despite I disliking it it), and also whipped up another script: random images. :> You can find the link on this page, as I do not want to link it here (most images there are probably NSFW..)

Also changed the design a bit, still ugly, but improved.



Daniel

2009-11-27 04:05:06

From: Harry
http://harryy.us/upload/

Simple little script, was bored, and a friend requested it. Mostly based off my former file uploader.


I intentionally have the speeds limited. It will go a bit slow. The reasoning behind this being:
1) A user can't upload some huge image for use on their site, then hotlink it and (ab)use my bandwidth.
2) It makes for more stability.

I don't run this as a replacement for Tinypic, I just made it for my friends who were tired of Imageshack removing their Hentai =P





So, try it out, let me know what you think. :)

Don't you mean your hentai?

Good job, otherwise. Is it a very similar or the same process to upload files as it is to upload images? Or does this script check the headers/extension of the image file?

code841

2009-11-27 04:51:23

^Was thinking the same thing.
Bah mostly loli -_-;
And "NOOOOOOOOOOOO!" @ using captcha/js.
You should put in some of those quick copy/paste links stuff.
Eg. Forum BB CODE:
[noparse][/noparse]

Also have you thought of generating thumbnails to save quota? Can all be done in php.

Nava2

2009-11-27 05:59:07

Yuup. A lot of hentai..

Harry

2009-11-27 10:26:57

From: code841
[noparse][/noparse]

Also have you thought of generating thumbnails to save quota? Can all be done in php.

Possibility :3

How would I get PHP to make thumbnails?

[QUOTE=Dan's The Man;659715]Don't you mean your hentai?

Good job, otherwise. Is it a very similar or the same process to upload files as it is to upload images? Or does this script check the headers/extension of the image file?

Nope. :P

It's the same, just the script checks the Mime-types of the files so it only allows images.

code841

2009-11-27 10:43:12

Unfortunately I lost all my php work when my 1TB Seagate HDD failed, so I cannot post exactly what I played around with. But I learned from googling around and it was very easy to get working.

Harry

2010-01-09 17:16:35

Improved the design, added thumbnailing, etc. Let me know what you think!

Gu3st...

2010-01-09 20:06:17

Add some colors and and a web 2.0 logo and it would be pro-looking :)

Craig`

2010-01-10 06:08:28

Yes the markup fag has posted.

You're using the table, br, center, b, small elements which is just bad (not to mention that you're missing the html, head and body elements and doctype…)

also reading the posts people have recommended using JavaScript for validation, which is just insane, you can easily disable JavaScript in any browser, and thus bypass your validation.

~ markup fag.