Jump to content
Sign in to follow this  
Armed Rebel

Upload Script

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...