Want users to upload their own images

liunx

Guest
Hi,<br /><br />I have no troubles at all with what has been discussed so far (putting the files the image folder myslef), but what about if I would like my users to upload their own images.<br /><br />I have set the "file" type in my form and when they submit I try the following:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><form name="frmRegister" method="POST" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data"><br /><input type="file" name="Imagefile" size="20"><br /><input type="submit" value="Register"><br /></form><!--c2--></div><!--ec2--><br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->if($_FILES['Imagefile']['type'] == "image/gif")<br />{    <br />      echo "submitted";<br />      copy ($_FILES['Imagefile']['tmp_name'], "images/user19.gif"); //also tried "/images/user19.gif" and got same problem<br />}<!--c2--></div><!--ec2--><br /><br />I get "failed to open stream: Permission denied"<br /><br />Is this a coding failure on my part, am I supposed to set permissions before trying to copy it from the temp folder or is this something out of my control?<br /><br />Thanks,<!--content-->
Sorry I get this error when I try using the rename function.<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->open_basedir restriction in effect. File(/images/user19.jpg) is not within the allowed path(s)<!--c2--></div><!--ec2--><br /><br />according to googling I get this for such a problem<br /><br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->This error indicates that your host has enabled the PHP open_base_dir setting on your server. Your host needs to add your Movable Type installation folder to the allowed paths for this setting (i.e., add the file path referenced in the error as "not within the allowed path").<br /><br />The open_base_dir setting is primarily used to prevent php scripts for a particular user from accessing files in another user's account. So usually, any files in your own account should be readable by your own scripts.<!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />Not sure if this'll help, but any suggestions on a fix would be great,<br /><br />Thanks<!--content-->
Welcome to the forum, kryles. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><br /><br />I have splitted and moved your posts from the thread in "Client written tutorials" and made it as its own topic.<!--content-->
welcome to the forum kryles <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> <br /><br />For the permissions issue, you need to set write permission on the folder you are trying to upload to. <br /><br />With the open_basedir issue, that's because the path is wrong. Try using the whole path /home/cpusername/public_html/images/user19.jpg where cpusername is your cpanel username. <br /><!--content-->
Welcome to the forum kryles <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
 
Top