Making sawdust
Join Date: May 2004
Location: Minnesota
|
Hey guys, i just wanted to let anyone know that if they want a place to host their images, i have section set up on my webserver so that you can. All i ask is that you please do not abuse this service and only use it for hosting on this forum.
Image Hosting |
quote |
Unique Like Everyone Else
|
You want me to fix that script for you so they CAN'T overwrite some one's image?
|
quote |
Veteran Member
Join Date: May 2004
Location: Chicago
|
You might also want to warn the kiddies that a good bit of stuff housed on the aforementioned server is not safe for work.
|
quote |
Making sawdust
Join Date: May 2004
Location: Minnesota
|
ahh, ya, forgot about that bit
if you want to fix it, heres the code : [PHP]<?php $site_name = $_SERVER['HTTP_HOST']; $url_dir = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']); $url_this = "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; $upload_dir = "pix/"; $upload_url = $url_dir."pix/"; $message =""; //create upload_files directory if not exist //If it does not work, create on your own and change permission. if (!is_dir("pix")) { die ("pix directory doesn't exist"); } if ($_FILES['userfile']) { $message = do_upload($upload_dir, $upload_url); } else { $message = "Invalid File Specified."; } print $message; function do_upload($upload_dir, $upload_url) { $temp_name = $_FILES['userfile']['tmp_name']; $file_name = $_FILES['userfile']['name']; $file_type = $_FILES['userfile']['type']; $file_size = $_FILES['userfile']['size']; $result = $_FILES['userfile']['error']; $file_url = $upload_url.$file_name; $file_path = $upload_dir.$file_name; //File Name Check if ( $file_name =="") { $message = "Invalid File Name Specified"; return $message; } //File Size Check else if ( $file_size > 500000) { $message = "The file size is over 500K."; return $message; } //File Type Check else if ( $file_type == "text/plain" ) { $message = "Sorry, You cannot upload any script file" ; return $message; } $result = move_uploaded_file($temp_name, $file_path); $message = ($result)?"File url <a href=$file_url>$file_url</a>" : "Somthing is wrong with uploading a file."; return $message; } ?> <form name="upload" id="upload" ENCTYPE="multipart/form-data" method="post"> Upload Image<input type="file" id="userfile" name="userfile"> <input type="submit" name="upload" value="Upload"> </form> <p> This is a free service provided by me, I won't be here to moderate it every five seconds, so i urge yo\ u to not abuse this as i can take it away at any time. Below is a list of currently uploaded files, p\ lease choose a unique name for yours so you do not overwrite somone else's image. <br> <iframe src="/pix/" height="80%"> </iframe> [/PHP] |
quote |
Member
Join Date: Jul 2004
Location: SoCal
|
I saw this bizzare preview in the movie theater this past weekend for Agent155.com - so I went to check it out and it's for artists, musicians, actors, filmakers, etc... and they are offering free accounts for the next month or so - with 500MB of portfolio storage space and a template for your portfolio page. Doesn't seem like there's many strings attached, so if you fit the bill, check it out! It never hurts to have too much publicity!
(well, unless you're Michael Jackson, that is!) :wow: Life is hard... wear a cup. |
quote |
Unique Like Everyone Else
|
I'll take a look at it sometime tomorrow. I have to finish up some stuff for work tonight. I'll have it back at ya tomorrow, all you gotta do is load the dir into an array and check and see if the uploaded file is in the array, if it is use die to give them an error.
WARNING: Do not let Dr. Mario touch your genitals. He is not a real doctor. |
quote |
Making sawdust
Join Date: May 2004
Location: Minnesota
|
ya, i figured as much. its just been so long since ive done php that it'd take me a few days to get working
|
quote |
Posting Rules | Navigation |
|
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
iTMS Free Song Listing | HOM | Apple Products | 64 | 2008-11-08 13:47 |
Like Google image search? me too | Wrao | AppleOutsider | 7 | 2004-06-22 16:46 |
Web Hosting | ast3r3x | General Discussion | 4 | 2004-05-19 09:28 |