<?php $picfile = "/var/www/public_html/ws3/pic.jpg"; if(strlen(basename($_FILES["image"]["name"])) > 0){ $stripped = trim(str_replace(" ","", $_FILES["image"]["name"])); if(move_uploaded_file($_FILES["image"]["tmp_name"], $picfile)){ @chmod($picfile,0755); echo "Ok!"; }else{ echo "Error copying! ".$_FILES["image"]["tmp_name"]." to ".$picfile." reason:". $_FILES["image"]["error"] ; } }else{ echo "Error uploading!"; } ?> <!DOCTYPE html> <html lang="en"> <head> <title>Web Share Target Demo</title> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- import the webpage's stylesheet --> <link rel="stylesheet" href="./style.css"> <!-- Manifest --> <link rel="manifest" href="./manifest.json"> </head> <body> <h1> Img Upload Demo </h1> <p> <b>href:</b> <code><span id="href"></span></code> </p> <p> <img src="//demo.com/ws3/pic.jpg<?php echo "?".time(); ?>" width="100%" /> </p> </body> </html>