Armed Rebel Posted January 17, 2006 Share Posted January 17, 2006 I'm using a tutorial this from PHPFreaks.com about uploading, and I've copied everything it said onto my upload.php page. For some reason I can't get it working. <html><head><title>Upload Test</title></head><body><form name="form1" method="post" action="" enctype="multipart/form-data"> <input type="file" name="imagefile"> <br> <input type="submit" name="Submit" value="Submit"> <? if(isset( $Submit )) { if ($_FILES['imagefile']['type'] == "image/gif"){ copy ($_FILES['imagefile']['tmp_name'], "[directory it will be placed in](This was written by me, only part of the code I changed)".$_FILES['imagefile']['name']) or die ("Could not copy"); echo ""; echo "Name: ".$_FILES['imagefile']['name'].""; echo "Size: ".$_FILES['imagefile']['size'].""; echo "Type: ".$_FILES['imagefile']['type'].""; echo "Copy Done...."; } else { echo "<br><br>"; echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")<br>"; } } ?> </form></body></html> Any reason it wouldn't be working?I do plan on rewriting this, I'm just doing it to see how it works. Link to comment Share on other sites More sharing options...
Armed Rebel Posted January 18, 2006 Author Share Posted January 18, 2006 Okay, the (first) problem was the submit wasn't working, bad tutorial I guess.Now that I got the submit working, I get the foloowing error trying to upload hte file: Warning: copy(): open_basedir restriction in effect. File(/home/nwtclan.net/subdomains/files/httpdocs/img/pwnage.gif) is not within the allowed path(s): (/home//nwtclan.net/subdomains/test/httpdocs:/tmp) in /home/nwtclan.net/subdomains/test/httpdocs/upload2.php on line 21Warning: copy(/home/nwtclan.net/subdomains/files/httpdocs/img/pwnage.gif): failed to open stream: Operation not permitted in /home/nwtclan.net/subdomains/test/httpdocs/upload2.php on line 21 Link to comment Share on other sites More sharing options...
zanfranceschi Posted January 19, 2006 Share Posted January 19, 2006 Looks like permition issues... you don't have permition to write to the dir you want... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now