php - I can upload images and files on my website on desktop fine, but on mobile it doesnt work -


i have separate gallery , file section. both work fine on desktop not mobile.

gallery code - links invalid image page every time. when image should ok upload.

    //when upload button pressed if (isset($_files['image']['tmp_name'])) {     $image = date(u).$_files['image']['name'];     $target = "gallery_images/".$username."/".$image;     $sql = "insert `images` (username, image) values ('$username', '$image')";     move_uploaded_file($_files['image']['tmp_name'], $target);     mysqli_query($link, $sql);      //checking see if uploaded file image     $file_type = image_type_to_mime_type(exif_imagetype($target));     $allowed = array("image/jpeg", "image/jpg", "image/gif", "image/png", "image/svg+xml", "image/bmp", "video/x-flv". "video/mp4", "application/x-mpegurl", "video/mp2t", "video/3gpp", "video/quicktime", "video/x-msvideo", "video/x-ms-wmv");      if(in_array($file_type, $allowed)){         header("location:gallery.php");     }else{         header("location:invalid_file.php?img=$image");     } } 

file code - uploads file name db doesn't put file in designated folder

    //when uploadfile pressed - file stored in db , folder if (isset($_files['file']['tmp_name'])) {     if($_files['file']['name'] == $row["file"]){         header("location:file_copy.php");     }else{         $file = $_files['file']['name'];         $target = "file_storage/".$username."/".$file;         $sql = "insert `files` (username, file) values ('$username', '$file')";         move_uploaded_file($_files['file']['tmp_name'], $target);         mysqli_query($link, $sql);         header("location:files.php");          } 

compere correct code yours.

<?php $connection=mysqli_connect("localhost","root","","imgup"); if(isset($_post['create_post'])){     $post_image = $_files['image']['name'];     $post_image_temp = $_files['image']['tmp_name'];     move_uploaded_file($post_image_temp, "images/$post_image");     $query = "insert img(post_image) ";     $query .= "values('{$post_image}')";     $create_post_query = mysqli_query($connection, $query); } ?>  <form action="fileup.php" method="post" enctype="multipart/form-data">                 <label for="post_image">post image</label>         <input type="file"  name="image">            <input type="submit" name="create_post" value="publish">  </form> 

Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -