{"id":4216,"date":"2021-10-16T07:00:00","date_gmt":"2021-10-16T01:30:00","guid":{"rendered":"https:\/\/selfimagination.in\/tips\/?p=4216"},"modified":"2022-01-07T20:33:34","modified_gmt":"2022-01-07T15:03:34","slug":"php-file-upload","status":"publish","type":"post","link":"https:\/\/selfimagination.in\/tips\/php-file-upload\/","title":{"rendered":"PHP File Upload"},"content":{"rendered":"\n<p>\u091c\u092c \u092d\u0940 \u0939\u092e\u0947\u0902 PHP Server \u092a\u0930 \u0915\u094b\u0908 \u092d\u0940 File Upload \u0915\u0930\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u0924\u092c  HTML Tag file \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0924\u0947 \u0939\u0948\u0902, \u0909\u0938\u0915\u0947 \u092c\u093e\u0926 \u0939\u092e form tag \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 Server \u092a\u0930 Submit Button \u0915\u0947 \u0926\u094d\u0935\u093e\u0930\u093e Request Send \u0915\u0930 \u0926\u0947\u0924\u0947 \u0939\u0948\u0902\u0964 \u0910\u0938\u093e \u0939\u092e\u0947 \u0907\u0938\u0932\u093f\u090f \u0915\u0930\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u0915\u094d\u092f\u0941\u0915\u0940 \u091c\u094b \u092d\u0940 File \u0939\u0948\u0902 \u0935\u0939 \u0906\u092a\u0915\u0940 Local Computer \u092a\u0930 \u0939\u0948\u0902 \u0914\u0930 \u0939\u092e \u0909\u0938\u0947 Server \u092a\u0930 \u092d\u0947\u091c\u0928\u093e \u091a\u093e\u0939\u0924\u0947 \u0939\u0948\u0902 \u0907\u0938\u0932\u093f\u090f \u0939\u092e\u0947 PHP \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 File \u0915\u094b Upload \u0915\u0930\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<p>\u0907\u0938 \u0928\u093f\u092e\u094d\u0928 Code \u0915\u094b \u0906\u092a \u0905\u092a\u0928\u0947 Page \u092a\u0930 add \u0915\u0930\u0947 \u0914\u0930 \u090f\u0915 \u0905\u0928\u094d\u092f Page \u091c\u093f\u0938 \u092a\u0930 Submit \u0939\u094b\u0928\u0947 \u092a\u0930 Request \u091c\u093e\u090f\u0917\u0940 \u0909\u0938\u0915\u0947 \u092c\u093e\u0930\u0947 \u092e\u0947\u0902 \u0906\u092a\u0915\u094b \u0906\u0917\u0947 \u092c\u0924\u093e \u0930\u0939\u093e \u0939\u0941\u0964  <\/p>\n\n\n\n<pre title=\"Upload.html \/ Upload.php\" class=\"wp-block-code\"><code lang=\"markup\" class=\"language-markup\">&lt;html&gt;\n\t&lt;head&gt;\n\t\t&lt;title&gt;File Upload&lt;\/title&gt;\n\t&lt;\/head&gt;\n\t&lt;body&gt;\n\n\t\t&lt;form method = \"post\" action=\"FileUploadExmple.php\" enctype=\"multipart\/form-data\"&gt;\n\t\t\t&lt;input type =\"file\" name=\"MyFile\" id=\"MyFile\"&gt;\n\t\t\t&lt;input type =\"submit\" name=\"submit\" Value=\"Upload File\"&gt;\n\t\t&lt;\/form&gt;\n\n\t&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<p>\u0905\u092c \u091c\u094b \u0906\u092a\u0915\u094b \u090f\u0915 PHP File \u092c\u0928\u093e\u0928\u093e \u0939\u0948\u0902 \u091c\u093f\u0938\u092e\u0947 \u0915\u0940 \u0906\u092a \u0915\u094b $_FILES[] \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u091c\u094b File \u0939\u092e\u093e\u0930\u0947 \u0926\u094d\u0935\u093e\u0930\u093e Select \u0915\u0940 \u0917\u0908 \u0939\u0948\u0902 \u0909\u0938\u0915\u0947 \u0926\u093f \u0917\u0908 \u0921\u093e\u092f\u0930\u0947\u0915\u094d\u091f\u0930\u0940 \u092e\u0947\u0902 Upload \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902\u0964 <\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">PHP Simple File Upload Example <\/h2>\n\n\n\n<p>Code \u092e\u0947\u0902 Comment \u092e\u0947\u0902 \u0939\u092e\u0928\u0947 \u0915\u0941\u091b Number \u0932\u093f\u0916\u0947 \u0939\u0948\u0902 \u0909\u0928 \u0938\u092d\u0940 Point \u0915\u0947 \u092c\u093e\u0930\u0947 \u092e\u0947\u0902 \u0939\u092e \u0906\u092a\u0915\u094b \u0938\u092e\u091d\u093e\u0924\u0947 \u0939\u0948\u0902\u0964 <\/p>\n\n\n\n<pre title=\"FileUploadExmple.php\" class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php\n\nif (isset($_POST['submit']))                                     \/\/1 \n{\n\n\t$MyDir          = \"upload\/\";                             \/\/2\n\t\n\t$SourceFile     = $_FILES[\"MyFile\"][\"tmp_name\"];         \/\/3\n\t$SourceFileName = $_FILES[\"MyFile\"][\"name\"];             \/\/4\n\t\n\t$FileName       = basename($SourceFileName);             \/\/5\n\t$TargetFileName = $MyDir . $FileName;                    \/\/6\n\n\t$v = move_uploaded_file($SourceFile, $TargetFileName );  \/\/7\n\t\n\tif ($v)                                                  \/\/8   \n\t{\n\t\tEcho \"\\nFile Uploaded Successfully!\";\t         \/\/9\n\t}\n\telse\n\t{\n\t\tEcho \"\\nFile Not Uploaded\";\t                 \/\/10\n\t}\n\n}\n\n?&gt;<\/code><\/pre>\n\n\n\n<p><strong>if (isset($_POST[&#8216;submit&#8217;]))  :<\/strong>  \u0907\u0938 Syntax \u0938\u0947 \u0939\u092e \u091a\u0947\u0915 \u0915\u0930\u0924\u0947 \u0939\u0948 \u0915\u0940 \u091c\u094b \u0939\u092e\u0928\u0947 \u092a\u0939\u0932\u0940 \u092b\u093e\u0907\u0932 Upload.php \u092f\u093e Upload.php \u091c\u094b \u092d\u0940 \u092c\u0928\u093e\u092f\u0940\u0902 \u0939\u094b \u0909\u0938\u0915\u0947 \u0938\u092c\u092e\u093f\u091f \u092c\u091f\u0928 \u0915\u094b Press \u0915\u093f\u092f\u093e \u0939\u0948\u0902 \u0915\u094d\u092f\u093e ? \u092f\u0926\u093f \u0939\u093e , \u0924\u094b \u0939\u0940 \u092f\u0939 Code \u0915\u094b Read \u0915\u0930\u0947\u0917\u093e <\/p>\n\n\n\n<p><strong>$MyDir                  = &#8220;upload\/&#8221;; : <\/strong>  \u0907\u0938 Syntax \u0938\u0947 \u0939\u092e  Default Directory \u0915\u093e \u0928\u093e\u092e \u0926\u0947\u0924\u0947 \u0939\u0948\u0902 \u092f\u0926\u093f \u0906\u092a \u091c\u0939\u093e \u092a\u0930 \u0906\u092a\u0915\u094b \u0905\u0928\u094d\u092f File Save \u0939\u0948\u0902 \u0935\u0939\u0940 \u092a\u0930 \u0938\u094d\u091f\u094b\u0930 \u0915\u0930\u0928\u093e \u091a\u093e\u0939\u0924\u0947 \u0939\u0948\u0902 \u0924\u094b \u092b\u093f\u0930 \u092f\u0939\u093e\u0901 \u092a\u0930 Blank \u0939\u0940 \u0930\u0916\u0947\u0964 \u091c\u094b \u092d\u0940 \u0906\u092a Directory \u0915\u093e \u0928\u093e\u092e \u0926\u0947 \u0930\u0939\u0947 \u0939\u0948\u0902 \u0909\u0938 Name \u0938\u0947 \u090f\u0915 Folder \u091c\u0939\u093e \u092a\u0930 \u0906\u092a\u0915\u0940 \u092f\u0939 \u0926\u094b\u0928\u094b\u0902 File Save \u0939\u0948\u0902 \u0909\u0938 Folder \u092e\u0947\u0902 \u091c\u0930\u0942\u0930 \u092c\u0928\u093e\u092f\u0947\u0964 <\/p>\n\n\n\n<p><strong>$SourceFile           = $_FILES[&#8220;MyFile&#8221;][&#8220;tmp_name&#8221;]; :<\/strong> \u0907\u0938 Syntax \u0938\u0947 \u0939\u092e \u091c\u094b \u0939\u092e\u0928\u0947 File Select \u0915\u0940 \u0939\u0948\u0902 \u0909\u0938\u0915\u093e Reference  Variable \u092e\u0947\u0902 Store \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u0924\u093e\u0915\u093f \u0906\u0917\u0947 Program \u092e\u0947\u0902 \u0939\u092e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0938\u0915\u0947\u0964  <\/p>\n\n\n\n<p><strong>$SourceFileName = $_FILES[&#8220;MyFile&#8221;][&#8220;name&#8221;]; :<\/strong>  \u0907\u0938 Syntax \u0938\u0947 \u0939\u092e \u091c\u094b \u0939\u092e\u0928\u0947 File Select \u0915\u0940 \u0939\u0948\u0902 \u0909\u0938\u0915\u093e  \u0928\u093e\u092e \u0939\u092e\u0928\u0947 Variable \u092e\u0947\u0902 Store \u0915\u093f\u092f\u093e \u0939\u0948\u0902\u0964 <\/p>\n\n\n\n<p><strong>$FileName            = basename($SourceFileName); :<\/strong>  \u0907\u0938 Syntax \u0938\u0947 \u0939\u092e File \u0915\u0947 Pure Path \u092e\u0947\u0902 \u0938\u0947 \u0915\u0947\u0935\u0932 File \u0915\u0947 \u0928\u093e\u092e \u0915\u094b \u0905\u0932\u0917 \u0915\u0930 \u0930\u0939\u0947 \u0939\u0948\u0902\u0964 \u0924\u093e\u0915\u093f \u0907\u0938 \u0928\u093e\u092e \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0939\u092e File \u0915\u094b Upload \u0915\u0930 \u0938\u0915\u0947\u0964 <\/p>\n\n\n\n<p><strong>$TargetFileName  = $MyDir . $FileName; :<\/strong>  \u0907\u0938 Syntax \u0938\u0947 \u0939\u092e \u090f\u0915 Target Path \u092c\u0928\u093e \u0930\u0939\u0947 \u0939\u0948\u0902 \u091c\u0939\u093e \u092a\u0930 \u0939\u092e\u0947\u0902 File \u0915\u094b Upload \u0915\u0930\u0935\u093e\u0928\u093e \u0939\u0948\u0902, \u092f\u0939\u093e\u0901 \u092a\u0930 Default Directory Name \u0915\u0947 \u0938\u093e\u0925 \u0939\u092e\u0928\u0947 File \u0915\u0947 \u0928\u093e\u092e \u0915\u094b \u091c\u094b\u095c\u0915\u0930 \u090f\u0915 Path \u092c\u0928\u093e \u0932\u093f\u092f\u093e \u0939\u0948\u0902\u0964  <\/p>\n\n\n\n<p><strong>$v = move_uploaded_file($SourceFile, $TargetFileName ); :<\/strong>  \u0907\u0938 Syntax \u0938\u0947 \u0939\u092e File \u0915\u094b Upload \u0915\u0930\u0924\u0947 \u0939\u0948\u0902\u0964 \u092f\u0939\u093e\u0901 \u092a\u0930 \u0939\u092e\u0947\u0902 Source \u0914\u0930 Target \u0926\u0947\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0902\u0964  \u0914\u0930 \u092f\u0926\u093f File Upload \u0939\u094b \u091c\u093e\u0924\u0940 \u0939\u0948\u0902 \u0924\u094b $v \u092e\u0947\u0902 True \u0905\u0928\u094d\u092f\u0925\u093e False \u0906 \u091c\u093e\u0924\u093e \u0939\u0948\u0902\u0964 <\/p>\n\n\n\n<p><strong>if ($v)   :<\/strong>   \u0907\u0938 Syntax \u0938\u0947 \u0939\u092e\u0928\u0947 \u091a\u0947\u0915 \u0915\u093f\u092f\u093e \u0939\u0948\u0902 \u0915\u0940 File \u0905\u092a\u0932\u094b\u0921 \u0939\u0941\u0908 \u0939\u0948\u0902 \u092f\u093e \u0928\u0939\u0940\u0902\u0964 True \u0914\u0930 False \u0915\u0940 \u092c\u0947\u0938 \u092a\u0930 \u0939\u092e\u0947\u0902 \u0907\u0938\u0915\u0947 \u092c\u093e\u0926 Message Show \u0915\u093f\u092f\u0947 \u0939\u0948\u0902\u0964 <\/p>\n\n\n\n<p><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Advance Logic   <\/h2>\n\n\n\n<p>\u092e\u0947\u0930\u093e \u0927\u094d\u092f\u093e\u0928 \u0939\u092e\u0947\u0936\u093e Code \u0915\u094b Common \u0932\u093f\u0916\u0928\u0947 \u092e\u0947\u0902 \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u092f\u093e\u0928\u093f \u0915\u0940 \u0939\u092e \u091c\u094b \u092d\u0940 Code \u092c\u0928\u093e\u092f\u0947 \u0909\u0938\u0915\u093e \u090f\u0915 Proper Function \u092c\u0928\u093e \u0915\u0930 \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0947 \u0924\u093e\u0915\u093f \u091c\u092c \u0939\u092e\u0947\u0902 \u0905\u0917\u0932\u0940 \u092c\u093e\u0930 same Code \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0928\u093e \u0939\u094b \u0924\u094b \u0939\u092e Copy Paste \u0915\u0930\u0928\u0947 \u0915\u0947 \u0938\u094d\u0925\u093e\u0928 \u092a\u0930 \u092a\u0939\u0932\u0947 \u0938\u0947 \u092c\u0928\u093e\u092f\u0947 \u0939\u0941\u090f Function \u0915\u093e \u0939\u0940 \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0938\u0915\u0947\u0964 <\/p>\n\n\n\n<p><strong>\u0905\u092c \u0939\u092e \u090f\u0915 \u090f\u0915 \u0915\u0930 File Upload \u092e\u0947\u0902 \u0915\u094d\u092f\u093e \u0915\u094d\u092f\u093e \u0914\u0930 Implement \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0935\u0939 \u0938\u092e\u091d\u0947\u0902\u0917\u0947\u0964 <\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Create Function :<\/strong> \u0938\u092c\u0938\u0947 \u092a\u0939\u0932\u0947 \u0909\u092a\u0930\u094b\u0915\u094d\u0924 Code \u0915\u093e \u090f\u0915 Function \u092c\u0928\u093e\u0928\u093e \u0938\u0940\u0916\u0947\u0902\u0917\u0947\u0964 <\/li><li><strong>Create Directory Automatically :<\/strong> \u0909\u0938\u0915\u0947 \u092c\u093e\u0926 \u0939\u092e\u0928\u0947 \u091c\u094b Directory \u092e\u0948\u0928\u094d\u092f\u0941\u0905\u0932 \u092c\u0928\u093e\u0908 \u0925\u0940 \u0909\u0938\u0947 \u092d\u0940 \u090f\u0915 Code \u0938\u0947 \u092c\u0928\u093e \u0926\u0947\u0902\u0917\u0947\u0964 <\/li><li><strong>File Type :<\/strong> \u0909\u0938\u0915\u0947 \u092c\u093e\u0926 \u0939\u092e \u092f\u0926\u093f Image \u0939\u0940 Upload \u0939\u094b \u092f\u093e Text File \u0939\u0940 \u0905\u092a\u0932\u094b\u0921 \u0939\u094b \u0910\u0938\u093e \u0915\u0941\u091b \u091a\u0947\u0915 \u0932\u0917\u093e\u0928\u093e \u091a\u093e\u0939\u0947 \u0924\u094b \u092d\u0940 \u0932\u0917\u093e \u0915\u0930 \u0938\u0940\u0916\u0947\u0902\u0917\u0947\u0964 <\/li><li><strong>File Exists : <\/strong>\u092f\u0926\u093f \u091c\u094b File \u0939\u092e Upload \u0915\u0930 \u0930\u0939\u0947 \u0939\u0948\u0902 \u0935\u0939 \u092a\u0939\u0932\u0947 \u0938\u0947 \u092e\u094c\u091c\u0942\u0926 \u0939\u094b \u0924\u094b \u0909\u0938\u0947 Replace \u0915\u0930\u0947 \u092f\u093e \u0928 \u0915\u0930\u0947 \u0909\u0938\u0947 \u092c\u093e\u0930\u0947 \u092e\u0947\u0902 \u0938\u092e\u091d\u0947\u0902\u0917\u0947\u0964 <\/li><li><strong>File Size : <\/strong>\u092f\u0926\u093f \u0906\u092a \u091a\u093e\u0939\u0924\u0947 \u0939\u0948\u0902 \u0915\u0940 \u092b\u093e\u0907\u0932 \u0915\u0940 \u0938\u093e\u0907\u091c \u092d\u0940 \u0939\u092e \u091c\u094b \u092c\u0924\u093e\u092f\u0947 \u0909\u0938\u0938\u0947 \u091c\u094d\u092f\u093e\u0926\u093e \u0915\u0940 Upload \u0928 \u0939\u094b \u0924\u094b \u0939\u092e \u0935\u0939 \u0938\u0940\u0916\u0947\u0902\u0917\u0947\u0964 <\/li><li><strong>Image Pixel Size :<\/strong> \u092f\u0926\u093f \u0939\u092e Image File Upload \u0915\u0930 \u0930\u0939\u0947 \u0939\u0948\u0902 \u0914\u0930 \u0939\u092e \u091a\u093e\u0939\u0924\u0947 \u0939\u0948\u0902 \u0915\u0940 \u0939\u092e\u0947\u0902 \u091c\u094b Pixel Size \u0926\u0947 \u0909\u0938\u0915\u0947 \u0905\u0928\u0941\u0938\u093e\u0930 \u0939\u0940 File \u0905\u092a\u0932\u094b\u0921 \u0939\u094b \u0924\u094b \u0935\u0939 \u092d\u0940 \u0938\u0940\u0916\u0947\u0902\u0917\u0947\u0964 <\/li><li><strong>Resolution :<\/strong> \u0915\u092d\u0940 \u0915\u092d\u0940 \u0939\u092e\u0947\u0902 Image \u0915\u0947 Resolution \u092a\u0930 \u092d\u0940 \u0915\u094b\u0908 \u091a\u0947\u0915 \u0932\u0917\u093e\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u0915\u0940 \u0915\u092e \u0938\u0947 \u0915\u092e \u0907\u0924\u0928\u0947 DPI \u0915\u0940 \u0907\u092e\u0947\u091c \u0939\u094b\u0928\u093e \u0939\u0940 \u091a\u093e\u0939\u093f\u090f \u0924\u094b \u0939\u092e \u0907\u0938 \u0924\u0930\u0939 \u0915\u0947 \u091a\u0947\u0915 \u0932\u0917\u093e \u0915\u0930 \u092d\u0940 \u0938\u0940\u0916\u0947\u0902\u0917\u0947\u0964 <\/li><li><strong>Show Uploaded Image : <\/strong>\u092f\u0926\u093f Image File \u0939\u0948\u0902 \u0914\u0930 \u0906\u092a \u0909\u0938\u0947 Upload \u0939\u094b\u0928\u0947 \u0915\u0947 \u092c\u093e\u0926 \u0926\u093f\u0916\u093e\u0928\u093e \u091a\u093e\u0939\u0947 \u0924\u094b \u0909\u0938\u0947 \u0926\u093f\u0916\u093e \u092d\u0940 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0909\u0938\u0915\u0947 \u092c\u093e\u0930\u0947 \u092e\u0947\u0902 \u092d\u0940 \u0938\u0940\u0916\u0947\u0902\u0917\u0947\u0964 <\/li><li><strong>Final Function :<\/strong> \u0914\u0930 \u0905\u0902\u0924 \u092e\u0947\u0902 \u0939\u092e \u0938\u092d\u0940 Code \u0915\u094b \u090f\u0915 \u0915\u0930 \u090f\u0915 \u0906\u0926\u0930\u094d\u0936 Function \u092c\u0928\u093e \u0932\u0947\u0902\u0917\u0947 \u091c\u093f\u0938\u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0906\u092a File \u0905\u092a\u0932\u094b\u0921 \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902\u0964 <\/li><\/ul>\n\n\n\n<p>\u0905\u092c \u0939\u092e \u090f\u0915 \u090f\u0915 \u0915\u0930 \u0909\u092a\u0930\u094b\u0915\u094d\u0924 \u0938\u092d\u0940 Point \u0938\u092e\u091d\u0924\u0947 \u0939\u0948\u0902\u0964 <\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">PHP File Upload : Create a Common Function <\/h2>\n\n\n\n<p>\u0939\u092e\u0928\u0947 \u091c\u094b \u0905\u092d\u0940 File Upload \u0915\u093e Example \u0926\u0947\u0916\u093e \u0909\u0938\u092e\u0947  <strong>MyFile<\/strong> Variable \u091c\u094b \u0915\u0940 \u0939\u092e\u0928\u0947 HTML File \u091c\u0939\u093e \u0938\u0947 \u0939\u092e File Select \u0915\u0930 \u0930\u0939\u0947 \u0925\u0947 \u0909\u0938\u0915\u0947 \u0905\u0928\u0941\u0938\u093e\u0930 \u0939\u0940 \u0932\u093f\u092f\u093e \u0939\u0948\u0902 \u092f\u0926\u093f \u0939\u092e \u0907\u0938\u0915\u0947 Name \u0915\u094b \u090f\u0915 \u0935\u0947\u0930\u093f\u090f\u092c\u0932 \u092e\u0947\u0902 \u0932\u0947 \u0924\u094b \u0939\u092e\u0947\u0902 \u092f\u0926\u093f \u090f\u0915 \u0938\u0947 \u0905\u0927\u093f\u0915 \u092b\u093e\u0907\u0932 \u0905\u092a\u0932\u094b\u0921 \u0915\u0930\u0928\u093e \u0939\u0948\u0902 \u0924\u094b \u0939\u092e \u0915\u0947\u0935\u0932 Name \u092c\u0926\u0932 \u0915\u0930 \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u092a\u093e\u090f\u0902\u0917\u0947 <\/p>\n\n\n\n<p>\u0938\u093e\u0925 \u0939\u0940 \u092e\u0947\u0902 \u0939\u092e\u0928\u0947 \u091c\u094b Directory \u0915\u093e \u0928\u093e\u092e \u0932\u093f\u092f\u093e \u0939\u0948\u0902 \u0909\u0938\u0947 \u092d\u0940 \u0939\u092e \u090f\u0915 Function \u0915\u0947 Parameter \u0915\u0947 \u0930\u0942\u092a \u092e\u0947\u0902 Pass \u0915\u0930\u0947\u0902\u0917\u0947\u0964<\/p>\n\n\n\n<p>\u0938\u092c\u0938\u0947 \u092a\u0939\u0932\u0947 \u0906\u092a\u0915\u094b \u091c\u094b Html \u092b\u093e\u0907\u0932 \u092c\u0928\u093e\u0908 \u0925\u0940 \u0909\u0938\u092e\u0947 \u090f\u0915 \u0932\u093e\u0907\u0928 \u0914\u0930 Add \u0915\u0930\u0928\u093e \u0939\u0948\u0902 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"markup\" class=\"language-markup\">&lt;input type =\"file\" name=\"MyFile\" id=\"MyFile\"&gt;\n&lt;BR&gt;&lt;input type =\"file\" name=\"MyFile1\" id=\"MyFile1\"&gt; &lt;!--Add This Line --&gt;<\/code><\/pre>\n\n\n\n<p>\u0909\u092a\u0930\u094b\u0915\u094d\u0924 \u0932\u093e\u0907\u0928 \u0938\u0947 \u0939\u092e\u0947\u0902 \u090f\u0915 \u0914\u0930 File Tag \u0932\u0917\u093e\u092f\u093e \u0924\u093e\u0915\u093f \u0939\u092e \u090f\u0915 \u0914\u0930 image \u092f\u093e File \u0905\u092a\u0932\u094b\u0921 \u0915\u0930 \u0938\u0915\u0947 <\/p>\n\n\n\n<p>\u0905\u092c \u0939\u092e\u0947\u0902 \u092a\u0939\u0932\u0947 Upload \u0915\u093e \u090f\u0915 \u092b\u0902\u0915\u094d\u0936\u0928 \u092c\u0928\u093e \u0932\u0947\u0902\u0917\u0947 \u0914\u0930 \u092b\u093f\u0930 \u0909\u0938 \u092b\u0902\u0915\u094d\u0936\u0928 \u0915\u094b 2 \u092c\u093e\u0930 \u0905\u0932\u0917 \u0905\u0932\u0917 \u0928\u093e\u092e \u0938\u0947 Call \u0915\u0930 \u0926\u0947\u0902\u0917\u0947 <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Multiple File Upload in PHP<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php\n\nif (isset($_POST['submit']))\n{\n\t\n\tfunction FileUpload($MyDir, $MyFile)\n\t{\n\n                \/\/1. Comment This and Pass as a Parameter\n\t\t\/\/$MyDir          = \"upload\/\";                   \n\n        \t\/\/2. Replace First Parameter to a Variable, and pass as a parameter\n\t\t$SourceFile     = $_FILES[$MyFile][\"tmp_name\"];  \n\n                \/\/3. Replace First Parameter to a same Variable\n\t\t$SourceFileName = $_FILES[$MyFile][\"name\"];      \n\t\t\n\t\t$FileName       = basename($SourceFileName);\n\t\t$TargetFileName = $MyDir . $FileName;\n\n\t\t$v = move_uploaded_file($SourceFile, $TargetFileName );\n\t\t\n\t\tif ($v)\n\t\t{\n\t\t\tEcho \"\\nFile Uploaded Successfully!\";\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEcho \"\\nFile Not Uploaded\";\t\n\t\t}\n\t}\n\t\n\tFileUpload(\"upload\/\", \"MyFile\");   \/\/ For First File\n\tFileUpload(\"upload\/\", \"MyFile1\");  \/\/ For Second File\n\n}\n\n?&gt;<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>\/\/$MyDir          = &#8220;upload\/&#8221;; :<\/strong> \u091c\u094b Directory \u0915\u093e \u0928\u093e\u092e \u092f\u0939\u093e\u0901 \u0921\u093f\u095e\u0949\u0932\u094d\u091f \u0932\u093f\u092f\u093e \u0925\u093e \u0907\u0938\u0947 \u0915\u092e\u0947\u0902\u091f \u0915\u093f\u092f\u093e \u0939\u0948\u0902 \u0914\u0930 Parameter \u092e\u0947\u0902 Pass \u0915\u093f\u092f\u093e \u0939\u0948\u0902 <\/li><li><strong>$SourceFile     = $_FILES[$MyFile][&#8220;tmp_name&#8221;];  :<\/strong> \u092f\u0939\u093e\u0901 \u092a\u0930 \u0939\u092e\u0947\u0902 \u092a\u0939\u0932\u0947 &#8220;MyFile&#8221; \u0932\u093f\u092f\u093e \u0925\u093e \u0909\u0938\u0915\u0947 \u0938\u094d\u0925\u093e\u0928 \u092a\u0930 \u0905\u092c  $MyFile \u0935\u0947\u0930\u093f\u090f\u092c\u0932 \u0932\u0947 \u0915\u0930 \u0909\u0938\u0947 \u092d\u0940 Function \u0915\u0947 Parameter \u0915\u0947 \u0930\u0942\u092a \u092e\u0947\u0902 \u0909\u092a\u092f\u094b\u0917 \u0915\u093f\u092f\u093e \u0939\u0948\u0902\u0964 <\/li><li><strong>FileUpload(&#8220;upload\/&#8221;, &#8220;MyFile&#8221;);  :<\/strong> \u092f\u0939\u093e\u0901 \u0938\u0947 \u0939\u092e\u093e\u0930\u0947 \u092c\u0928\u093e\u092f\u0947 \u0939\u0941\u0935\u0947 function \u0915\u094b call \u0915\u093f\u092f\u093e \u0939\u0948\u0902 , \u092f\u0939\u093e\u0901 \u092a\u0930 \u0906\u092a\u0915\u094b \u091c\u093f\u0938 \u092d\u0940 Directory \u092e\u0947\u0902 File upload \u0915\u0930\u0928\u093e \u0939\u0948\u0902 \u0935\u0939 \u0926\u0947\u0928\u093e \u0939\u0948\u0902 \u0914\u0930 \u091c\u093f\u0938 file tag \u0938\u0947 File \u0932\u0947\u0928\u093e \u0939\u0948\u0902 \u0909\u0938\u0915\u093e \u0928\u093e\u092e \u0926\u0947\u0928\u093e \u0939\u0948\u0902 , \u092f\u0939\u093e\u0901 \u092a\u0930 \u0939\u092e\u0928\u0947 \u0926\u094b File \u0915\u094b \u090f\u0915 \u0939\u0940 Folder \u092e\u0947\u0902 Upload \u0915\u093f\u092f\u093e \u0939\u0948\u0902 \u0907\u0938\u0932\u093f\u090f \u0939\u092e\u0928\u0947 Folder\/Directory Name \u0915\u094b \u0928\u0939\u0940\u0902 \u092c\u0926\u0932\u093e \u0914\u0930 File Name \u0915\u094b \u092c\u0926\u0932 \u0926\u093f\u092f\u093e \u0939\u0948\u0902\u0964  <\/li><\/ul>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u0939\u092e\u093e\u0930\u0947 \u0905\u0928\u094d\u092f \u0906\u0930\u094d\u091f\u093f\u0915\u0932<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/selfimagination.in\/tips\/learn-c-basic-n-advance\/\">Learn C \u2013 \u0939\u093f\u0902\u0926\u0940 \u092e\u0947\u0902<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/mysql-aggregate-function-in-hindi\/\">MySQL Aggregate Function in Hindi<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/mysql-sys-exec-example-with-trigger\/\">MySQL SYS_EXEC Example With Trigger<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/get-post-method\/\">GET &amp; POST Method | Difference Between GET &amp; POST<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/php-validation-filter-var-preg_match\/\">PHP Validation | filter_var | preg_match<\/a><\/li><\/ul>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">How to Create Directory Automatic <\/h2>\n\n\n\n<p>PHP Creating Directory if not Exists <\/p>\n\n\n\n<p>\u0905\u092d\u0940 \u0939\u092e\u0947\u0902 \u092f\u0939 \u0927\u094d\u092f\u093e\u0928 \u0930\u0916\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u0915\u0940 \u091c\u094b \u092d\u0940 \u0939\u092e Default Directory \u0926\u0947 \u0930\u0939\u0947 \u0939\u0948\u0902 \u0935\u0939 \u0939\u092e\u0947\u0902 Manual \u091c\u093e \u0915\u0930 \u092c\u0928\u093e\u0928\u0940 \u0939\u094b\u0924\u0940 \u0939\u0948, \u092f\u0926\u093f \u0915\u093f\u0938\u0940 \u0915\u093e\u0930\u0923 \u0938\u0947 \u0939\u092e Directory \u092c\u0928\u093e\u0928\u093e \u092d\u0942\u0932 \u091c\u093e\u0924\u0947 \u0939\u0948\u0902 \u0924\u094b \u092f\u0939 Code Directory Check \u0915\u0930 \u0916\u0941\u0926 \u0939\u0940 \u092c\u0928\u093e \u0926\u0947\u0917\u093e\u0964 <\/p>\n\n\n\n<p>\u0906\u092a\u0915\u094b \u0907\u0938 \u0915\u094b\u0921 \u0915\u094b \u0938\u092c\u0938\u0947 \u092a\u0939\u0932\u0947 \u0909\u092a\u092f\u094b\u0917 \u092e\u0947\u0902 \u0932\u0947\u0928\u093e \u0939\u0948\u0902\u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">\/\/$MyDir          = \"upload\/\";     \/\/After this line Add \n\n\n\/\/ For Creating Directory if not Exists\n\nif(!is_dir($MyDir)) \n{\n\tmkdir($MyDir);\n}<\/code><\/pre>\n\n\n\n<p>\u0905\u092c \u092e\u0947\u0902 \u0906\u092a\u0915\u094b \u0938\u093f\u0930\u094d\u092b \u091c\u094b Code \u092e\u0947\u0902 Change \u0915\u0930 \u0930\u0939\u093e \u0939\u0941 \u0935\u0939\u0940 \u092c\u0924\u093e \u0930\u0939\u093e \u0939\u0941 \u0905\u0902\u0924 \u092e\u0947\u0902 \u0938\u092d\u0940 Code \u0915\u094b Merge \u0915\u0930 \u090f\u0915 \u0938\u093e\u0925 \u092c\u0924\u093e \u0926\u0942\u0902\u0917\u093e \u092f\u0926\u093f \u092e\u0947\u0902 \u092c\u093e\u0930 \u092c\u093e\u0930 \u092a\u0942\u0930\u093e \u092a\u0942\u0930\u093e Code \u092f\u0939\u093e\u0901 \u092a\u0930 \u0932\u093f\u0916\u0942\u0902\u0917\u093e \u0924\u094b article \u092c\u0939\u0941\u0924 \u092c\u095c\u093e \u0939\u094b \u091c\u093e\u090f\u0917\u093e <\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">File Type Check : \u0915\u093f\u0938 \u092a\u094d\u0930\u0915\u093e\u0930 \u0915\u0940 File \u0939\u0940 Upload \u0939\u094b \u0909\u0938\u0915\u0947 \u0932\u093f\u090f <\/h2>\n\n\n\n<p>PHP File Type Checking Before Upload<\/p>\n\n\n\n<p>\u091c\u092c \u0939\u092e\u0947\u0902 File \u0915\u0947 Extension \u092a\u0930 \u0915\u094b\u0908 \u091a\u0947\u0915 \u0932\u0917\u093e\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u0924\u094b \u0939\u092e \u0907\u0938 \u091a\u0947\u0915 \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0924\u0947 \u0939\u0948\u0902\u0964 <\/p>\n\n\n\n<p>\u0907\u0938\u0915\u0947 \u0932\u093f\u090f \u0939\u092e\u0947\u0902 \u0938\u092c\u0938\u0947 \u092a\u0939\u0932\u0947 \u091c\u094b \u092b\u093e\u0907\u0932 Upload \u0939\u094b\u0928\u0947 \u0935\u093e\u0932\u0940 \u0939\u0948\u0902 \u0909\u0938\u0915\u0947 \u0928\u093e\u092e \u092e\u0947\u0902 \u0938\u0947 Extension \u0928\u093f\u0915\u0932\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u092b\u093f\u0930 \u0909\u0938\u0947 \u0939\u092e\u0947\u0902 \u0905\u092a\u0928\u0947 \u0905\u0928\u0941\u0938\u093e\u0930 Condition \u0932\u0917\u093e\u0928\u093e \u0939\u094b\u0924\u0940 \u0939\u0948\u0902 \u0935\u0948\u0938\u0947 Simple Logic \u0915\u0941\u091b \u0907\u0938 \u092a\u094d\u0930\u0915\u093e\u0930 \u0939\u0948\u0902\u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">\/\/For Get File Extension\n$FileType = strtolower(pathinfo($FileName,PATHINFO_EXTENSION));\nif ($FileType == 'jpg' or $FileType == 'jpeg' or $FileType == 'png')\n{}\nelse\n{\n\techo \"&lt;BR&gt;Pls upload jpeg, jpg, png File Only\";\n        return;\n}<\/code><\/pre>\n\n\n\n<p>\u0932\u0947\u0915\u0928 \u0939\u092e \u0907\u0938\u0947 \u090f\u0915 Function \u092e\u0947\u0902 \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0930\u0939\u0947 \u0939\u0948\u0902 \u0907\u0938\u0932\u093f\u090f \u0939\u092e\u0947\u0902 \u092f\u0939 Condition \u092f\u0939\u093e\u0901 \u0915\u0947 \u092c\u091c\u093e\u092f\u0947 Variable \u0938\u0947 \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0928\u093e \u0939\u094b\u0917\u0940 \u0907\u0938\u0932\u093f\u090f \u0939\u092e File move upload \u0915\u0947 \u092a\u0939\u0932\u0947 \u0928\u093f\u092e\u094d\u0928 Code \u0915\u094b Implement \u0915\u0930 \u0926\u0947\u0902\u0917\u0947 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">function FileUpload($MyDir, $MyFile, $AcceptFileType = \"\")  \/\/ Add in Parameter <\/code><\/pre>\n\n\n\n<p>function \u092e\u0947\u0902 \u092a\u0948\u0930\u093e\u092e\u0940\u091f\u0930 \u092e\u0947\u0902  $AcceptFileType = &#8220;&#8221;  Parameter pass \u0915\u0930\u0947\u0902\u0917\u0947 \u0909\u0938\u0915\u0947 \u092c\u093e\u0926 \u0939\u092e move_uploaded_file function Call \u0915\u0930\u0928\u0947 \u0915\u0947 \u092a\u0939\u0932\u0947 \u0939\u092e \u092f\u0939 Code \u0932\u0917\u093e \u0926\u0947\u0902\u0917\u0947 \u0924\u093e\u0915\u093f \u092f\u0926\u093f \u091c\u094b File Type \u0939\u092e Accept \u0915\u0930\u0928\u093e \u091a\u093e\u0939\u0924\u0947 \u0939\u0948\u0902 \u0935\u0939\u0940 File Type Accept \u0939\u094b\u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">if (trim($AcceptFileType) != \"\")\n{\t\n\n        $FileType = strtolower(pathinfo($FileName,PATHINFO_EXTENSION));\n\t$Accept_File_Type=1;\n\t$ar = explode(\",\", $AcceptFileType);\n\t$cnt = count($ar);\n\t\n\tfor ($i=0; $i&lt;$cnt; $i++)\n\t{\n\t\t$Accept_File_Type=0;\n\t\tif (strtolower($ar[$i]) == $FileType)\n\t\t{\n\t\t\t$Accept_File_Type=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tif ($Accept_File_Type==0)\n\t{\n\t\techo \"&lt;BR&gt;Accept Only (\" . $AcceptFileType .\" ) Files\" ;\n\t\treturn;\n\t}\n}<\/code><\/pre>\n\n\n\n<pre title=\"Example \" class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">FileUpload(\"upload\/\", \"MyFile\", \"png,jpg\");<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a href=\"https:\/\/play.google.com\/store\/apps\/details?id=com.sl.SQL_Logic\" target=\"_blank\" rel=\"noopener\">MySQL \u0938\u093f\u0916\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u0915\u094d\u0932\u093f\u0915 \u0915\u0930\u0947 <\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">How to Check File Already Exists or Not (Duplicate File)<\/h2>\n\n\n\n<p>\u092f\u0926\u093f \u092f\u0939 File \u092a\u0939\u0932\u0947 \u0938\u0947 Upload \u0939\u094b \u0914\u0930 \u0939\u092e \u091a\u093e\u0939\u0924\u0947 \u0939\u0948\u0902 \u0915\u0940 \u092f\u0939 \u092b\u093f\u0930 \u0938\u0947 \u0905\u092a\u0932\u094b\u0921 \u0928 \u0939\u094b \u0924\u094b \u0939\u092e \u0907\u0938 \u092a\u094d\u0930\u0915\u093e\u0930 \u0938\u0947 \u0932\u0949\u091c\u093f\u0915 \u0932\u0917\u093e \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">\/\/, $ShowExistsMsg = false \/\/Add this parameter on Function \n\nif ($ShowExistsMsg == true)\n{\t\n\tif (file_exists($TargetFileName))\n\t{\n\t\techo \"&lt;&gt;$TargetFileName File Already Exists&lt;br&gt;\";\n         \treturn;\n\t}\n}<\/code><\/pre>\n\n\n\n<pre title=\"Example \" class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">FileUpload(\"upload\/\", \"MyFile\", \"png,jpg\", true);  <\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">PHP File Upload Size Check <\/h2>\n\n\n\n<p>\u092f\u0939\u093e\u0901 \u092a\u0930 File \u0915\u0940 Size Bytes \u092e\u0947\u0902 \u0939\u094b\u0924\u0940 \u0939\u0948\u0902 \u0907\u0938\u0932\u093f\u090f \u0939\u092e\u0947\u0902 \u0909\u0938\u0947 KB, MB, GB \u0906\u0926\u093f \u092e\u0947\u0902 \u092c\u0926\u0932\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0902\u0964 \u0907\u0938\u0915\u0947 \u0932\u093f\u090f \u0939\u092e \u0907\u0938 \u092a\u094d\u0930\u0915\u093e\u0930 \u0938\u0947 Function \u092c\u0928\u093e \u0938\u0915\u0924\u0947 \u0939\u0948\u0902\u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">function GetSizeDesc($val)\n{\n\tif ($val &gt;= (1048 * 1048 * 1048))\t\n\t\treturn \tround($val\/(1048 * 1048 * 1048),2) . \" GB\";\n\telse if ($val &gt;= (1048 * 1048))\t\t\n\t\treturn \tround($val\/(1048 * 1048),2) . \" MB\";\n\telse if ($val &gt;= 1048)\t\t\n\t\treturn \tround($val\/1048,2) . \" KB\";\n\telse \n\t\treturn \t$val . \" Bytes\";\n}<\/code><\/pre>\n\n\n\n<p>Function \u092e\u0947\u0902 \u0915\u0947 Argument \u092c\u095d\u093e\u0928\u093e \u0939\u094b\u0917\u093e<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">$MaxFileSize = 0  \/\/Add this Argument in Function <\/code><\/pre>\n\n\n\n<p>\u0905\u092c \u092f\u0939 \u0939\u092e move_uploaded_flle \u092b\u0902\u0915\u094d\u0936\u0928 \u0915\u0947 \u092a\u0939\u0932\u0947 \u0915\u0949\u0932 \u0915\u0930\u0928\u093e \u0939\u0948\u0902 <\/p>\n\n\n\n<pre title=\"Example \" class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">\/\/File Size\nif ($MaxFileSize &gt; 0)\n{\n\t$FileSize = $_FILES[$MyFile][\"size\"];\n\tif ($FileSize &gt; $MaxFileSize)\n\t{\n\t        echo \"&lt;BR&gt;Your File Size is \".GetSizeDesc($FileSize).\", It is Greater than \" . GetSizeDesc($MaxFileSize);\n\t\treturn;\n\t}\n}<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">PHP Get Pixel Size of any Image<\/h2>\n\n\n\n<p>\u092f\u0926\u093f \u0906\u092a Image Upload \u0915\u0930 \u0930\u0939\u0947 \u0939\u0948\u0902 \u0914\u0930 \u0906\u092a \u091a\u093e\u0939\u0924\u0947 \u0939\u0948\u0902 \u0915\u0940 \u0907\u092e\u0947\u091c \u0939\u092e\u093e\u0930\u0947 \u0926\u094d\u0935\u093e\u0930\u093e \u0926\u0940 \u0917\u0908 Size \u092e\u0947\u0902 \u0939\u0940 Accept \u0939\u094b \u0924\u094b \u0906\u092a Width \u0914\u0930 Height \u0938\u0947\u091f \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 , \u091a\u093e\u0939\u0947 \u0924\u094b \u0906\u092a \u0907\u0938 \u092a\u0941\u0930\u0947 Function \u0915\u094b \u0905\u092a\u0928\u0940 Requirement \u0915\u0947 \u0905\u0928\u0941\u0938\u093e\u0930 \u092c\u0926\u0932 \u092d\u0940 \u0938\u0915\u0924\u0947 \u0939\u0948\u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">, $PixelW=0, $PixelH=0  \/\/ Add Two Arguments <\/code><\/pre>\n\n\n\n<p>\u0905\u092c \u092f\u0939 \u092b\u0902\u0915\u094d\u0936\u0928 \u091c\u094b \u0915\u0940 \u0938\u092c\u0938\u0947 \u092a\u0939\u0932\u0947 \u091a\u0947\u0915 \u0915\u0930\u0947\u0917\u093e \u0915\u0940 Upload \u0915\u0940 \u0917\u0908 File Image \u0939\u0948 \u092f\u093e \u0928\u0939\u0940\u0902 , \u0914\u0930 \u092f\u0926\u093f Image \u0939\u0948\u0902 \u0924\u094b \u0909\u0938\u0915\u0940 Pixel Check \u0915\u0930 \u0932\u0947\u0917\u093e \u0914\u0930 \u092f\u0926\u093f \u0905\u092a\u0928\u0947 \u092f\u0939 Parameter Pass \u0928\u0939\u0940\u0902 \u0915\u093f\u092f\u093e \u0924\u094b \u0915\u093f\u0938\u0940 \u092d\u0940 \u092a\u094d\u0930\u0915\u093e\u0930 \u0915\u0940 Checking \u0928\u0939\u0940\u0902 \u0939\u094b\u0917\u0940\u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">\/\/ For Pixel Checking\nif ( $PixelW &gt; 0 and $PixelH &gt; 0)\n{\n\t$ImagePixel = getimagesize($SourceFile);\n\tif($ImagePixel !== false)\n\t{\n\t\t$w = $ImagePixel[0];\n\t\t$h = $ImagePixel[1];\n\t\t\n\t\tif ($w != $PixelW or $h != $PixelH)\n\t\t{\n\t\t      echo \"&lt;BR&gt;Accept Only Pixel Size $PixelW X $PixelH.\";\n\t\t      return;\n\t\t}\n        }\n\telse\n\t{\n\t\techo \"&lt;BR&gt;Uploaded File is Not an Image\";\n\t\treturn;\n\t}\n}\t<\/code><\/pre>\n\n\n\n<p>\u0905\u092c \u0939\u092e \u0907\u0938 \u092a\u094d\u0930\u0915\u093e\u0930 \u0938\u0947 Function \u0915\u094b Call \u0915\u0930\u0947\u0902\u0917\u0947 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">FileUpload(\"upload\/\", \"MyFile\", \"png,jpg\", true, (80 * 1048), 1200, 628);<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Image Resolution Check <\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>\u092f\u0926\u093f \u0939\u092e Image \u0915\u0947 Resolution \u0915\u0947 \u0905\u0928\u0941\u0938\u093e\u0930 \u092d\u0940 \u0915\u094b\u0908 Check \u0932\u0917\u093e\u0928\u093e \u091a\u093e\u0939\u0924\u0947 \u0939\u0948\u0902 \u0924\u094b \u0907\u0938 Code \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 <\/li><li>\u0907\u0938\u092e\u0947\u0902 \u0938\u092c\u0938\u0947 \u092a\u0939\u0932\u0947 \u0939\u092e \u092b\u093e\u0907\u0932 \u0915\u093e Extension \u0915\u093e \u092a\u0924\u093e \u0932\u0917\u093e\u0924\u0947 \u0939\u0948\u0902 <\/li><li>\u0909\u0938\u0915\u0947 \u092c\u093e\u0926 \u0939\u092e\u0947\u0902 jpeg, png \u092a\u0924\u093e \u0932\u0917\u093e \u0915\u0930 \u090f\u0915 temporary \u0907\u092e\u0947\u091c \u092c\u0928\u093e\u0924\u0947 \u0939\u0948\u0902 <\/li><li>\u0914\u0930 \u0909\u0938 Image \u0938\u0947 \u0939\u092e Resolution \u0915\u094b Get \u0915\u0930\u0924\u0947 \u0939\u0948\u0902\u0964 \u0906\u0907\u092f\u0947 \u0938\u092e\u091d\u0924\u0947 \u0939\u0948\u0902\u0964 <\/li><\/ul>\n\n\n\n<pre title=\"Add in Function Argument \" class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">, $ResH=0, $ResV=0<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">if ($ResH &gt; 0 and $ResV &gt; 0)\n{\n\t$FileType = strtolower(pathinfo($FileName,PATHINFO_EXTENSION));\n\tif ($FileType == 'jpeg' or $FileType == 'jpg' or $FileType == 'png')\n\t{\n\t\t$image =\"\";\n\t\t\n\t\tif ($FileType == 'png')\n\t\t\t$image = imagecreatefrompng($SourceFile);\n\t\telse\n\t\t\t$image = imagecreatefromjpeg($SourceFile);\n\t\t\n\t\t$v = imageresolution($image);\n\t\t$rh = $v[0];\n\t\t$rv = $v[1];\n\t\t\t\t\t\n\t\tif ($rh != $ResH or $rv != $ResV)\n\t\t{\n\t\t    echo \"&lt;BR&gt;Image Resolution (H:$rh V:$rv) is Not Correct Required Resolution is H:$ResH, V:$ResV\";\n\t\t    return;\n\t\t}\n\t}\t\n}<\/code><\/pre>\n\n\n\n<pre title=\"Function Calling \" class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">FileUpload(\"upload\/\", \"MyFile\", \"png,jpg\", true, (80 * 1048), 1200, 628, 96,96); <\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong style=\"color: revert; font-size: revert;\">Show Uploaded Image <\/strong><\/h2>\n\n\n\n<p><strong>How to display image selected by file upload in PHP?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u092f\u0926\u093f \u0906\u092a \u091a\u093e\u0939\u0924\u0947 \u0939\u0948\u0902 \u0915\u0940 Image Upload \u0939\u094b\u0928\u0947 \u0915\u0947 \u092c\u093e\u0926 \u0926\u093f\u0916\u093e\u0908 \u092d\u0940 \u0926\u0947\u0928\u0947 \u0932\u0917\u0947 \u0924\u094b \u0906\u092a \u0907\u0938 Code \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902\u0964 <\/li><li>\u091c\u092c \u092b\u093e\u0907\u0932 Successfully Upload \u0939\u094b \u091c\u093e\u0924\u0940 \u0939\u0948\u0902 \u0909\u0938\u0915\u0947 \u092c\u093e\u0926 \u0939\u0940 \u0907\u0938 Code \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902\u0964 <\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">, $ImgW=300, $ImgH=150) \/\/ Add Function Argument <\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>\u092f\u0939\u093e\u0901 \u092a\u0930 \u0939\u092e\u0947\u0902 \u0921\u093f\u095e\u0949\u0932\u094d\u091f \u0935\u0948\u0932\u094d\u092f\u0942 \u0926\u0940 \u0939\u0948\u0902 , \u0906\u092a \u0905\u092a\u0928\u0947 \u0905\u0928\u0941\u0938\u093e\u0930 \u0909\u0938\u092e\u0947 \u092c\u0926\u0932\u093e\u0935 \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902\u0964  <\/li><\/ul>\n\n\n\n<pre title=\"Example Show Uploaded File \" class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">if ($v)\n{\n\tif ($ShowImgAftUpload == true)\n\t{\n\t\techo \"&lt;BR&gt;&lt;img width='$ImgW' height='$ImgH' src='\".$TargetFileName.\"'&gt;&lt;\/img&gt;\";\n\t}\n\tEcho \"&lt;BR&gt;File Uploaded Successfully!\";\t\n}\t\t<\/code><\/pre>\n\n\n\n<pre title=\"Calling Function \" class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">FileUpload(\"upload\/\", \"MyFile\", \"png,jpg\", true, (80 * 1048), 1200, 628, 96,96, true, 300, 150); <\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">PHP File Upload : A Complete Function (File Upload in PHP Example) <\/h2>\n\n\n\n<p>\u0939\u092e\u0928\u0947 \u0905\u092d\u0940 \u0924\u094b \u091c\u094b \u091b\u094b\u091f\u0947 \u091b\u094b\u091f\u0947 \u092d\u093e\u0917 \u092e\u0947\u0902 \u0938\u092e\u091d\u093e \u0909\u0928\u0915\u094b \u0939\u092e\u0928\u0947 \u090f\u0915 Complete Function \u092c\u0928\u093e \u0926\u093f\u092f\u093e \u0925\u093e <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php\n\nif (isset($_POST['submit']))\n{\n\tfunction GetSizeDesc($val)\n\t{\n\t\tif ($val &gt;= (1048 * 1048 * 1048))\t\n\t\t\treturn \tround($val\/(1048 * 1048 * 1048),2) . \" GB\";\n\t\telse if ($val &gt;= (1048 * 1048))\t\t\n\t\t\treturn \tround($val\/(1048 * 1048),2) . \" MB\";\n\t\telse if ($val &gt;= 1048)\t\t\n\t\t\treturn \tround($val\/1048,2) . \" KB\";\n\t\telse \n\t\t\treturn \t$val . \" Bytes\";\n\t}\n\t\n\t\n\tfunction FileUpload($MyDir, $MyFile, $AcceptFileType = \"\", $ShowExistsMsg = false, $MaxFileSize = 0, $PixelW=0, $PixelH=0, $ResH=0, $ResV=0, $ShowImgAftUpload=false, $ImgW=300, $ImgH=150)\n\t{\n\t\t\/\/$MyDir          = \"upload\/\";                   \/\/1. Comment This and Pass as a Parameter\n\t\t\n\t\t\/\/ For Creating Directory if not Exists\n\t\tif(!is_dir($MyDir)) \n\t\t{\n\t\t\tmkdir($MyDir);\n\t\t}\n\t\t\n\t\t$SourceFile     = $_FILES[$MyFile][\"tmp_name\"];  \/\/2. Replace First Parameter to a Variable, and pass as a parameter\n\t\t$SourceFileName = $_FILES[$MyFile][\"name\"];      \/\/2. Replace First Parameter to a same Variable\n\t\t$FileName       = basename($SourceFileName);\n\t\t$TargetFileName = $MyDir . $FileName;\n\t\t\n\t\t\/*\n\t\t\/\/For Get File Extension\n\t\t$FileType = strtolower(pathinfo($FileName,PATHINFO_EXTENSION));\n\t\tif ($FileType == 'jpg' or $FileType == 'jpeg' or $FileType == 'png')\n\t\t{}\n\t\telse\n\t\t{\n\t\t\techo \"&lt;BR&gt;Pls upload jpeg, jpg, png File Only\";\n\t\t\treturn;\n\t\t}\n\t\t*\/\n\t\t\n\t\tif ($ShowExistsMsg == true)\n\t\t{\t\n\t\t\tif (file_exists($TargetFileName))\n\t\t\t{\n\t\t\t\techo \"&lt;BR&gt;$FileName File Already Exists\";\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\t\t\n\t\t\n\t\t\n\t\tif (trim($AcceptFileType) != \"\")\n\t\t{\t\n\t\t\t$FileType = strtolower(pathinfo($FileName,PATHINFO_EXTENSION));\n\t\t\t$Accept_File_Type=1;\n\t\t\t$ar = explode(\",\", $AcceptFileType);\n\t\t\t$cnt = count($ar);\n\t\t\t\n\t\t\tfor ($i=0; $i&lt;$cnt; $i++)\n\t\t\t{\n\t\t\t\t$Accept_File_Type=0;\n\t\t\t\tif (strtolower($ar[$i]) == $FileType)\n\t\t\t\t{\n\t\t\t\t\t$Accept_File_Type=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif ($Accept_File_Type==0)\n\t\t\t{\n\t\t\t\techo \"&lt;BR&gt;Accept Only (\" . $AcceptFileType .\" ) Files\" ;\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t\/\/File Size\n\t\tif ($MaxFileSize &gt; 0)\n\t\t{\n\t\t\t$FileSize = $_FILES[$MyFile][\"size\"];\n\t\t\tif ($FileSize &gt; $MaxFileSize)\n\t\t\t{\n\t\t\t\techo \"&lt;BR&gt;Your File Size is \".GetSizeDesc($FileSize).\", It is Greater than \" . GetSizeDesc($MaxFileSize);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\t\/\/ For Pixel Checking\n\t\tif ( $PixelW &gt; 0 and $PixelH &gt; 0)\n\t\t{\n\t\t\t$ImagePixel = getimagesize($SourceFile);\n\t\t\tif($ImagePixel !== false)\n\t\t\t{\n\t\t\t\t$w = $ImagePixel[0];\n\t\t\t\t$h = $ImagePixel[1];\n\t\t\t\t\n\t\t\t\tif ($w != $PixelW or $h != $PixelH)\n\t\t\t\t{\n\t\t\t\t\techo \"&lt;BR&gt;Accept Only Pixel Size $PixelW X $PixelH.\";\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\techo \"&lt;BR&gt;Uploaded File is Not an Image\";\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\n\t\tif ($ResH &gt; 0 and $ResV &gt; 0)\n\t\t{\n\t\t\t$FileType = strtolower(pathinfo($FileName,PATHINFO_EXTENSION));\n\t\t\tif ($FileType == 'jpeg' or $FileType == 'jpg' or $FileType == 'png')\n\t\t\t{\n\t\t\t\t$image =\"\";\n\t\t\t\t\n\t\t\t\tif ($FileType == 'png')\n\t\t\t\t\t$image = imagecreatefrompng($SourceFile);\n\t\t\t\telse\n\t\t\t\t\t$image = imagecreatefromjpeg($SourceFile);\n\t\t\t\t\n\t\t\t\t$v = imageresolution($image);\n\t\t\t\t$rh = $v[0];\n\t\t\t\t$rv = $v[1];\n\t\t\t\t\t\n\t\t\t\tif ($rh != $ResH or $rv != $ResV)\n\t\t\t\t{\n\t\t\t\t\techo \"&lt;BR&gt;Image Resolution (H:$rh V:$rv) is Not Correct Required Resolution is H:$ResH, V:$ResV\";\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t}\t\n\t\t}\n\t\t\n\n\t\t$v = move_uploaded_file($SourceFile, $TargetFileName );\n\t\tif ($v)\n\t\t{\n\t\t\tif ($ShowImgAftUpload == true)\n\t\t\t{\n\t\t\t\techo \"&lt;BR&gt;&lt;img width='$ImgW' height='$ImgH' src='\".$TargetFileName.\"'&gt;&lt;\/img&gt;\";\n\t\t\t}\n\t\t\t\n\t\t\tEcho \"&lt;BR&gt;File Uploaded Successfully!\";\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tEcho \"&lt;BR&gt;File Not Uploaded\";\t\n\t\t}\n\t}\n\t\n\tFileUpload(\"upload\/\", \"MyFile\", \"png,jpg\", true, (80 * 1048), 1200, 628, 96,96, true, 300, 150);   \/\/ For First File\n\t\n\tFileUpload(\"upload\/\", \"MyFile1\");  \/\/ For Second File\n}\n\n?&gt;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u0906\u0936\u093e \u0939\u0948\u0902 \u092e\u0941\u091d\u0947 \u0915\u0940 \u0906\u092a\u0915\u094b FileUpload Function \u0915\u094b \u092c\u0939\u0941\u0924 \u0905\u091a\u094d\u091b\u0947 \u0938\u0947 \u0938\u092e\u091d \u0917\u090f \u0939\u094b\u0902\u0917\u0947 \u092b\u093f\u0930 \u092d\u0940 \u092f\u0926\u093f \u0906\u092a \u0915\u094b \u0915\u094b\u0908 \u092d\u0940 Doubt \u0939\u094b \u0924\u094b \u0906\u092a Comment \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902\u0964  <\/p>\n\n\n\n<p>\u092f\u0939 \u0906\u0930\u094d\u091f\u093f\u0915\u0932 \u0906\u092a\u0915\u094b \u0915\u0948\u0938\u093e \u0932\u0917\u093e \u0939\u092e\u0947 \u091c\u0930\u0942\u0930 \u092c\u0924\u093e\u090f \u0964 <\/p>\n\n\n\n<p>\u0905\u092a\u0928\u093e \u0915\u0940\u092e\u0924\u0940 \u0938\u092e\u092f \u0926\u0947\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u0927\u0928\u094d\u092f\u0935\u093e\u0926 <\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u091c\u092c \u092d\u0940 \u0939\u092e\u0947\u0902 PHP Server \u092a\u0930 \u0915\u094b\u0908 \u092d\u0940 File Upload \u0915\u0930\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u0924\u092c HTML Tag file \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0924\u0947 \u0939\u0948\u0902, \u0909\u0938\u0915\u0947 \u092c\u093e\u0926 \u0939\u092e form tag \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 Server \u092a\u0930 Submit Button \u0915\u0947 \u0926\u094d\u0935\u093e\u0930\u093e Request Send \u0915\u0930 \u0926\u0947\u0924\u0947 \u0939\u0948\u0902\u0964 \u0910\u0938\u093e \u0939\u092e\u0947 \u0907\u0938\u0932\u093f\u090f \u0915\u0930\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u0915\u094d\u092f\u0941\u0915\u0940 \u091c\u094b \u092d\u0940 File \u0939\u0948\u0902 \u0935\u0939 \u0906\u092a\u0915\u0940 Local Computer [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4314,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-4216","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2021\/10\/php-file-upload.jpg?fit=1200%2C628&ssl=1","_links":{"self":[{"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/posts\/4216","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/comments?post=4216"}],"version-history":[{"count":111,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/posts\/4216\/revisions"}],"predecessor-version":[{"id":6116,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/posts\/4216\/revisions\/6116"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/media\/4314"}],"wp:attachment":[{"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/media?parent=4216"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/categories?post=4216"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/tags?post=4216"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}