rallokkcaz Posted August 23, 2006 Share Posted August 23, 2006 I can't figure out how to get this to upload to the serverand then if its possible a thumbnail of the pic under that[code]<form name="form1" method="post" action="" enctype="multipart/form-data"> <input type="file" name="imagefile"> <br><input type="submit" name="Submit" value="Submit"> <br> <?php if(isset($Submit)){ $file=$_FILES['imagefile']['name']; $filetype=substr($file,-4); if($filetype=="jpeg"){ copy($_FILES['imagefile']['tmp_name'],"images/".$_FILES['imagefile']['name']) or die("Could not copy"); echo"<br>Upload Complete"; echo"<br>Name: ".$_FILES['imagefile']['name'].""; echo"<br>Size: ".$_FILES['imagefile']['size'].""; echo"<br>Type: ".$_FILES['imagefile']['type']."<br>"; }elseif($filetype==".jpg"){ copy($_FILES['imagefile']['tmp_name'],"images/".$_FILES['imagefile']['name']) or die("Could not copy"); echo"<br>Upload Complete"; echo"<br>Name: ".$_FILES['imagefile']['name'].""; echo"<br>Size: ".$_FILES['imagefile']['size'].""; echo"<br>Type: ".$_FILES['imagefile']['type']."<br>"; }elseif($filetype==".png"){ copy($_FILES['imagefile']['tmp_name'],"images/".$_FILES['imagefile']['name']) or die("Could not copy"); echo"<br>Upload Complete"; echo"<br>Name: ".$_FILES['imagefile']['name'].""; echo"<br>Size: ".$_FILES['imagefile']['size'].""; echo"<br>Type: ".$_FILES['imagefile']['type']."<br>"; }elseif($filetype==".gif"){ copy($_FILES['imagefile']['tmp_name'],"images/".$_FILES['imagefile']['name']) or die("Could not copy"); echo"<br>Upload Complete"; echo"<br>Name: ".$_FILES['imagefile']['name'].""; echo"<br>Size: ".$_FILES['imagefile']['size'].""; echo"<br>Type: ".$_FILES['imagefile']['type']."<br>"; }else{ echo"<br><span class="subtitle">Upload Error</span>"; echo"<br>Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")<br>"; } } ?> </form>[/code]pleeze help! Quote Link to comment Share on other sites More sharing options...
craygo Posted August 23, 2006 Share Posted August 23, 2006 You cannot use $Submit unless globals are turned on, which they are not by default you have to use $_POST['Submit']Ray Quote Link to comment Share on other sites More sharing options...
rallokkcaz Posted August 23, 2006 Author Share Posted August 23, 2006 where do i put that ??? Quote Link to comment Share on other sites More sharing options...
Corona4456 Posted August 23, 2006 Share Posted August 23, 2006 replace '$Submit' in your script with '$_POST['Submit']' Quote Link to comment Share on other sites More sharing options...
rallokkcaz Posted August 23, 2006 Author Share Posted August 23, 2006 where would i put the script to upload it to the database?and if possible make a thumb nail of it? Quote Link to comment Share on other sites More sharing options...
rallokkcaz Posted August 23, 2006 Author Share Posted August 23, 2006 Warning: copy(images/BEN.png) [function.copy]: failed to open stream: No such file or directory in /home/pokebash/public_html/pic_upload.php on line 24Could not copythat was the error message i just got what should i do to fix it.[code]<form name="form1" method="post" action="" enctype="multipart/form-data"> <input type="file" name="imagefile"> <br><input type="submit" name="Submit" value="Submit"> <br> <?php if(isset($_POST['Submit'])){ $file=$_FILES['imagefile']['name']; $filetype=substr($file,-4); if($filetype=="jpeg"){ copy($_FILES['imagefile']['tmp_name'],"images/".$_FILES['imagefile']['name']) or die("Could not copy"); echo"<br>Upload Complete"; echo"<br>Name: ".$_FILES['imagefile']['name'].""; echo"<br>Size: ".$_FILES['imagefile']['size'].""; echo"<br>Type: ".$_FILES['imagefile']['type']."<br>"; }elseif($filetype==".jpg"){ copy($_FILES['imagefile']['tmp_name'],"images/".$_FILES['imagefile']['name']) or die("Could not copy"); echo"<br>Upload Complete"; echo"<br>Name: ".$_FILES['imagefile']['name'].""; echo"<br>Size: ".$_FILES['imagefile']['size'].""; echo"<br>Type: ".$_FILES['imagefile']['type']."<br>"; }elseif($filetype==".png"){ copy($_FILES['imagefile']['tmp_name'],"images/".$_FILES['imagefile']['name']) or die("Could not copy"); echo"<br>Upload Complete"; echo"<br>Name: ".$_FILES['imagefile']['name'].""; echo"<br>Size: ".$_FILES['imagefile']['size'].""; echo"<br>Type: ".$_FILES['imagefile']['type']."<br>"; }elseif($filetype==".gif"){ copy($_FILES['imagefile']['tmp_name'],"images/".$_FILES['imagefile']['name']) or die("Could not copy"); echo"<br>Upload Complete"; echo"<br>Name: ".$_FILES['imagefile']['name'].""; echo"<br>Size: ".$_FILES['imagefile']['size'].""; echo"<br>Type: ".$_FILES['imagefile']['type']."<br>"; }else{ echo"<br><span class=\"subtitle\">Upload Error</span>"; echo"<br>Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")<br>"; } } ?> </form>[/code] Quote Link to comment Share on other sites More sharing options...
craygo Posted August 23, 2006 Share Posted August 23, 2006 That means it can't find the directorytry using the absolute path insteadreplace these lines[code]copy($_FILES['imagefile']['tmp_name'],"images/".$_FILES['imagefile']['name'])[/code]with this[code]copy($_FILES['imagefile']['tmp_name'],"/home/pokebash/public_html/images/".$_FILES['imagefile']['name'])[/code]Ray Quote Link to comment Share on other sites More sharing options...
rallokkcaz Posted August 23, 2006 Author Share Posted August 23, 2006 thanks but i figuered out what i did wrong i didn't make a folder called images!! really stupid mistake. Quote Link to comment Share on other sites More sharing options...
rallokkcaz Posted August 23, 2006 Author Share Posted August 23, 2006 now that ive figuered that out instaed of making a a boring directary page where the pics are stored is possible to make a page that the pics can go to ??? Quote Link to comment Share on other sites More sharing options...
craygo Posted August 23, 2006 Share Posted August 23, 2006 Yes look up on how to read a directory then lookup the gdlib functions to create thumbnails for the pics.Can't do everything for ya my manRay Quote Link to comment Share on other sites More sharing options...
rallokkcaz Posted August 23, 2006 Author Share Posted August 23, 2006 Thanks for the help people!! :D Quote Link to comment Share on other sites More sharing options...
Corona4456 Posted August 23, 2006 Share Posted August 23, 2006 If you feel like looking at some code ... look at phpWebAlbum (google it) and check it out. It uses gd to manipulate images. Quote Link to comment Share on other sites More sharing options...
litebearer Posted August 23, 2006 Share Posted August 23, 2006 Might also look here. With a little tweaking you can have it do what you want.(be sure to see the example)http://www.nstoia.com/toh/technical/listdir/index.phpLite... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.