Jump to content

jpratt

Members
  • Posts

    144
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jpratt's Achievements

Member

Member (2/5)

0

Reputation

  1. It may be your registered globals line.
  2. I am using the meta tag redirect in my html like so: <meta http-equiv="refresh" content="5; url=http://www.newsite.com"> I need the user to be able to have the choise to be able to go to the new site or go to the old htm page they were pointed to. I can not take down the old site. Any php solutions? Most users come in through google to specific pages. Is there a way to do this with php without renaming my old htm files?
  3. go to: http://us3.php.net/manual/en/features.file-upload.php has an example of uploading an array of files.
  4. ok i went back to my original plan. the code i had before was so close. I do understand arrays, but 3 if statements does not seenm to exsesive. Anyway i am alomost there. with this code I can upload the file if i leave the directory as '', this places the file in my root directory of course. i do have a folder called uploadimg i would like to place them in. when i set my directory in the code to 'uploadimg/' it says it uploaded successfuly but it accually does not do anything. here is what i am using now: [code] <?php if ($_SERVER['REQUEST_METHOD'] != 'POST') { $me = $_SERVER['PHP_SELF']; echo ' <form name="form1" method="post" action="' . $me . '" enctype="multipart/form-data"> <table width="500" border="0" cellspacing="3" cellpadding="0"> <tr> <td width="256" height="30" align="right" valign="middle"><p align="right"><span class="style1">Comment for Photo</span></p></td> <td width="344" align="left"><input name="textfield" type="text" size="40" /></td> </tr> <tr> <td height="30" align="right" class="style1">Website Link </td> <td align="left"> <input type="text" name="textfield2" /> <span class="style1">ie. www.google.com</span> </td> </tr> <tr> <td height="30" align="right"><span class="style1">Photo </span></td> <td align="left"><input type="file" name="imagefile" /></td> </tr> <tr> <td>&nbsp;</td> <td align="left"><input name="Submit" type="submit" value="Submit" /></td> </tr> </table> </form>'; } else { if (isset($_POST['Submit'])) { $file = $_FILES['imagefile']['name']; $filetype = substr($file,-4); if ($filetype=="jpeg") { copy($_FILES['imagefile']['tmp_name'],'uploadimg/'.$_FILES['imagefile']['name']) or die("Could not copy"); echo "<br>Upload Complete"; echo "<br>Name:&nbsp;".$_FILES['imagefile']['name'].""; echo "<br>Size:&nbsp;".$_FILES['imagefile']['size'].""; echo "<br>Type:&nbsp;".$_FILES['imagefile']['type']."<br>"; } else if ($filetype==".jpg") { copy($_FILES['imagefile']['tmp_name'],'uploadimg/'.$_FILES['imagefile']['name']) or die("Could not copy"); echo "<br>Upload Complete"; echo "<br>Name:&nbsp;".$_FILES['imagefile']['name'].""; echo "<br>Size:&nbsp;".$_FILES['imagefile']['size'].""; echo "<br>Type:&nbsp;".$_FILES['imagefile']['type']."<br>"; } else if ($filetype==".gif") { copy($_FILES['imagefile']['tmp_name'],'uploadimg/'.$_FILES['imagefile']['name']) or die("Could not copy"); echo "<br>Upload Complete"; echo "<br>Name:&nbsp;".$_FILES['imagefile']['name'].""; echo "<br>Size:&nbsp;".$_FILES['imagefile']['size'].""; echo "<br>Type:&nbsp;".$_FILES['imagefile']['type']."<br>"; } else { echo "<br>Upload Error"; echo "<br>Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")<br>"; } } } ?> [/code] Any ideas, im am almost there!
  5. sorry the "if($type) {" is not commented out.
  6. ok i have tried your code and it still will not upload. I have read the entire section on uploads from php.net. When i use your code it always tells me it is not the right file type. I have tried uploading .jpg, .gif. I left out the database code you had in there so it looks like this: [code] <?php // file upload information $uploaddir ="uploadimg/"; $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); // set a mime valadating $blah = getimagesize($userfile); $type = $blah['mime']; $width = $blah[0]; $size = $blah[2]=$_FILES['userfile']['size']; if($size <= 2000000) { //if($type) { // if file correct let file throw and into the folder if(move_uploaded_file($_FILES['userfile']['name'],$uploadfile)) { // say thank you if the user has a valid file. echo "file uploaded thank you<br>"; exit; } // echo link for valadating pic }else{ echo "Wrong file type .jpg or .gif thank you <br><br> <a href ='upload.php'>Pleae try again</a>"; } echo link for valadating file size }else{ echo "Wrong file size 2000000 bytes only<br><br> <a href ='upload.php'>Pleae try again</a>"; } ?> [/code] This is driving me crazy!
  7. sorry, i have been testing locally with the code above. The accual page is now at www.myplasmaart.com/upload.php. I am not using anything different that above, except i fixed the echo statement at the end. I am not even getting the "Upload Error" in my else if statement
  8. I have run through my php.ini file, checked with my host to make sure this is allowed, and still cont get this thing to work. I know the post is happening, but nothing is being displayed, no confirmation or denial of upload. Anymore suggestions other than how to clean up my code?
  9. Cant get this thing to work, does anyone have a better way of doing a file upload.
  10. thanks for the clean up. but it still does not function. I have checked my php.ini and verified it allowed uploads. Somthing is still wrong.
  11. all php tags are closed. I dont see a problem.
  12. page is at www.myplasmaart.com/upload.php
  13. What part of the page do you want centered? What does you HTML look like?
  14. I have the following script i am working with to upload an image. as far as i can tell the code works fine. When i go to display the page it wont come up and wont give an error, just a blank white page: [code] <?php if ($_SERVER['REQUEST_METHOD'] != 'POST') { $me = $_SERVER['PHP_SELF']; ?> <form name="form1" method="post" action="<?php echo $me;?>" enctype="multipart/form-data">               <table width="500" border="0" cellspacing="3" cellpadding="0">                 <tr>                   <td width="256" height="30" align="right" valign="middle"><p align="right"><span class="style1">Comment for Photo</span></p></td>                   <td width="344" align="left"><input name="textfield" type="text" size="40" /></td>                 </tr>                 <tr>                   <td height="30" align="right" class="style1">Website Link </td>                   <td align="left"><input type="text" name="textfield2" />                     <span class="style1">ie. www.google.com</span> </td>                 </tr>                 <tr>                   <td height="30" align="right"><span class="style1">Photo </span></td>                   <td align="left"><input type="file" name="imagefile" /></td>                 </tr>                 <tr>                   <td>&nbsp;</td>                   <td align="left"><input name="Submit" type="submit" value="Submit" /></td>                 </tr>               </table>               </form>   <?php   }   else{   if(isset($Submit)){   $file=$_FILES['imagefile']['name'];   $filetype=substr($file,-4);   if($filetype=="jpeg"){     copy($_FILES['imagefile']['tmp_name'],"UploadImg/".$_FILES['imagefile']['name'])     or die("Could not copy");     echo"<br>Upload Complete";     echo"<br>Name:&nbsp;".$_FILES['imagefile']['name']."";     echo"<br>Size:&nbsp;".$_FILES['imagefile']['size']."";     echo"<br>Type:&nbsp;".$_FILES['imagefile']['type']."<br>";   }elseif($filetype==".jpg"){     copy($_FILES['imagefile']['tmp_name'],"UploadImg/".$_FILES['imagefile']['name'])     or die("Could not copy");     echo"<br>Upload Complete";     echo"<br>Name:&nbsp;".$_FILES['imagefile']['name']."";     echo"<br>Size:&nbsp;".$_FILES['imagefile']['size']."";     echo"<br>Type:&nbsp;".$_FILES['imagefile']['type']."<br>";   }elseif($filetype==".png"){     copy($_FILES['imagefile']['tmp_name'],"UploadImg/".$_FILES['imagefile']['name'])     or die("Could not copy");     echo"<br>Upload Complete";     echo"<br>Name:&nbsp;".$_FILES['imagefile']['name']."";     echo"<br>Size:&nbsp;".$_FILES['imagefile']['size']."";     echo"<br>Type:&nbsp;".$_FILES['imagefile']['type']."<br>";   }elseif($filetype==".gif"){     copy($_FILES['imagefile']['tmp_name'],"UploadImg/".$_FILES['imagefile']['name'])     or die("Could not copy");     echo"<br>Upload Complete";     echo"<br>Name:&nbsp;".$_FILES['imagefile']['name']."";     echo"<br>Size:&nbsp;".$_FILES['imagefile']['size']."";     echo"<br>Type:&nbsp;".$_FILES['imagefile']['type']."<br>";   }else{     echo"<br><span class="subtitle">Upload Error</span>";     echo"<br>Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")<br>";   } } } ?>[/code] Any ideas?? Please Help!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.