<script> if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { var window_width = $(window).width(); if(window_width <= 991){ console.log(“Mobile Devices width is smaller than 991”); var windowHeight = $(window).height(), gridTop = windowHeight * .3, gridBottom = windowHeight * .8; $(window).scroll(function(){ $.each($(“[class$=area]”),function(){ var thisTop = $(this).offset().top – $(window).scrollTop(); if (thisTop > gridTop && (thisTop + $(this).height()) < gridBottom) { if($(this).css(“bottom”) != […]
PHP Curl with attachment ( CurlFile)
Sender PHP Code <form method=”post” action=”<?=$_SERVER[“PHP_SELF”] ?>” enctype=”multipart/form-data”> <input name=”file” type=”file” /> <input type=”submit” value=”Upload” /> </form> <?php if(!empty($_FILES)){ $target=”https://juliusgoh.life/tut/attachment-receiver.php”; echo “<pre>”; print_r($_FILES); echo “</pre>”; # http://php.net/manual/en/curlfile.construct.php // Create a CURLFile object / procedural method $cfile = curl_file_create($_FILES[“file”][“tmp_name”],$_FILES[“file”][“type”],$_FILES[“file”][“name”]); // try adding // Create a CURLFile object / oop method #$cfile = new CURLFile(“resource/test.png”,”image/png”,”testpic”); // uncomment […]
PHP Script uses bash command to find file created within mins ago
$dir = “/home/ec2-user/julius/tmp/”; $file_type = “json”; $min = “5”; #Created How Many Min Ago $output = shell_exec(“find $dir -cmin -$min -type f -name ‘*.$file_type'”); $json_file = explode(“\n”,$output); array_pop($json_file); # To remove last \n if(empty($json_file)){exit();} print_r($json_file);