Jump to content

Recommended Posts

Hi

 

Well I really don't know where to go from this, but basically I'm getting no errors, and the pages refreshes but there are never any new records, therefore it's not working, but I don't know what else to do

 

<?php

if(isset($_POST['submit'])) {

include ("blogconnect.php");

if(isset($_FILES['image']) && $_FILES['image']['size'] > 0) {
  
  // Temporary file name stored on the server
      $tmpName  = $_FILES['image']['tmp_name'];  
       
      // Read the file 
      $fp      = fopen($tmpName, 'r');
      $data = fread($fp, filesize($tmpName));
      $data = addslashes($data);
      fclose($fp);
  
  $sql = "INSERT INTO userimage (image) VALUES ('$data')";
  $query = mysql_query($sql, $connect); 
  
  echo 'Your image has been uploaded!';

}
else
echo 'No image selected or uploaded';
}
?>

Many thanks for your help, everything seems to act exactly the same, however it's my form I believe could be the issue

 

					<form enctype="multipart/form-data" form id="form1" name="form1" method="post" action="" class="form">
<input name="MAX_FILE_SIZE" value="1002400" type="hidden">
<input name="image" accept="image/jpeg" type="file">
<input value="Submit" type="submit">
</form>

 

I am checking that I'm only trying to upload a jpeg, and it's quite a small image, as I don't know the unit of measurement for the max file size value.

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

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