Jump to content

Im trying to build an uploader


zachary

Recommended Posts

Its wont loadIm trying to build a image uploader but im having a lot of troubleim using this:

<?php// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead// of $_FILES.$uploaddir = $_GET['uploaddirectory'];$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {    echo "File was successfully uploaded!"; $backmessage = "Upload another";                                                    } else { echo "Upload failed!"; $backmessage = "Back to upload";}echo "<br/><a href=\"upload.php\" title=\"$backmessage\">$backmessage</a>";?>
<title>Zachary8222's Image Hosting!</title><strong>Zachary8222's Image Hosting!</strong><br/><br/><em>Max upload size: 2 megabyte (2,097,152 bytes)</em><!-- The data encoding type, enctype, MUST be specified as below --><form enctype="multipart/form-data" action="results.php" method="POST">  <!-- MAX_FILE_SIZE must precede the file input field -->  <input type="hidden" name="MAX_FILE_SIZE" value="2097152" />  <!-- Name of input element determines name in $_FILES array -->  <input name="uploaddirectory" type="hidden" value="/home/DOMAINUSER/public_html/images/" size="50"/>  <input name="userfile" type="file" size="50"/><br/>  <input type="submit" value="submit" /></form><!-- --><script type="text/javascript" src="/i.js"></script>
need help asap
Link to comment
Share on other sites

Why didnt you just post in my topic? You took the other persons script anyways :) :) .If you want it to work you have to change some of the variables and form stuff..

Link to comment
Share on other sites

that script look familiar... lolanywho, what seems to be the trouble with it? if nothing is working at all, first check your php version. In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead of $_FILES. Also, make sure that the files have .php extentions. Are you getting any output at all (is the page loading? is the file just not being uploaded?)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...