Jump to content

Help with Image Uploader


byrne86

Recommended Posts

All I want to do is upload an image to my images folder, which is on the site root, so mysite.com/images

 

here is my code:

<form action="uploadimage.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
  <p>
    <label>Choose image to upload
      <input type="file" name="image" id="image" />
    </label>
  </p>
  <p>
    <label>
      <input type="submit" name="imageupload" id="imageupload" value="Upload Image" />
    </label>
  </p>
</form>

 

<?php
$imagename = "1testimage";
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/png")))

move_uploaded_file ($_FILES["file"]["tmp_name"],"images/" . $imagename.".gif");

?>

 

Cn anyone see why this is not working/ I have chenged the permissions on my hosting account to read and write...

Link to comment
https://forums.phpfreaks.com/topic/219123-help-with-image-uploader/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.