Im wanting an Image Up-Loader Script kind of like :www.tinypic.com or photobucket Can anyone give me a script or a link to a script?
heres a simple image uploader or file uploader //file format, type and size if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 20000)) { if ($_FILES["file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Stored in: " . $_FILES["file"]["tmp_name"]; } } else { echo "Invalid file"; } PHP: html code <form action="upload_file.php" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" id="file" /> <br /> <input type="submit" name="submit" value="Submit" /> </form> HTML: hope this help
The above code would not work. And if it did, it would not be secure. Never rely on the type value provided by the $_FILES array, as it comes directly from the browser. And therefore it can't be trusted.
And what do you suggest nico_swd? Ftp, applet May be a combination of the last script and ajax would be a good alternative.
PHP uploads can be secure, if you keep in mind a few important points. I suggest you have a read through this. http://www.scanit.be/uploads/php-file-upload.pdf