<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Core PHP code API for Image Upload &#8211; MaXEster Technologies  | Technical Blog</title>
	<atom:link href="https://www.maxester.com/blog/tag/core-php-code-api-for-image-upload/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.maxester.com/blog</link>
	<description>Tutorials, Examples and Implementation code for Developers Help</description>
	<lastBuildDate>Mon, 17 Feb 2025 09:17:48 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.22</generator>
	<item>
		<title>PHP Code for Upload File/Image to the server using Volley in Android</title>
		<link>https://www.maxester.com/blog/2020/07/28/php-code-for-upload-image-to-server-using-volley-in-android/</link>
		<comments>https://www.maxester.com/blog/2020/07/28/php-code-for-upload-image-to-server-using-volley-in-android/#respond</comments>
		<pubDate>Tue, 28 Jul 2020 10:07:07 +0000</pubDate>
		<dc:creator><![CDATA[Maxester]]></dc:creator>
				<category><![CDATA[Php]]></category>
		<category><![CDATA[Core PHP code API for Image Upload]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=1018</guid>
		<description><![CDATA[<p>This code will help you upload image to server which I have uploaded on &#8221; “http://seoforworld.com/api/v1/file-upload.php” For using this code create a page with the name file-upload.php.Also, create a directory with name of images Copy this code in file-upload.php Image&#8230;</p>
<p><a href="https://www.maxester.com/blog/2020/07/28/php-code-for-upload-image-to-server-using-volley-in-android/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2020/07/28/php-code-for-upload-image-to-server-using-volley-in-android/">PHP Code for Upload File/Image to the server using Volley in Android</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<center>
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads" style="display:inline-block;" data-ad-client="ca-pub-3804472713147276" data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>



<p>This code will help you upload image to server which I have uploaded on &#8221; <br><strong>“http://seoforworld.com/api/v1/file-upload.php”</strong> <br>For using this code create a page with the name file-upload.php.<br>Also, create a directory with name of images</p>



<p>Copy this code in file-upload.php</p>



<center>
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads" style="display:inline-block;" data-ad-client="ca-pub-3804472713147276" data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>



<pre class="wp-block-code"><code>&lt;?php



$api_version = 1.0;

$start = microtime(true);

$dir = $_SERVER['DOCUMENT_ROOT']."/api/v1/images/";



if( isset($_FILES['image']['name']) )

{

    $file_name = time().basename($_FILES['image']['name']);

    

    $extension = strtolower(pathinfo($file_name,PATHINFO_EXTENSION));



        if ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg') {



            if($_FILES["image"]["size"] &lt; 4000001){

                

                $file = $dir.$file_name;

                

                if( move_uploaded_file($_FILES['image']['tmp_name'], $file) )

                {

                    $arr = array(

                    'status'=>1, 

                    'message'=>"File Uploaded",

                    'file_name'=>$file_name

                    );

                }

                else

                {

                    $arr = array(

                    'status'=>0, 

                    'error'=>"Something Went Wrong Please Retry",

                    'file_name'=>$file_name

                    );

                }

                

            }

            else

            {

                $arr = array(

                'status'=>0,

                'error'=>"File size cant exceed 4 MB"

                );

            }  

        }

        else

        {

            $arr = array(

            'status'=>0,

            'error'=>"Only .png, .jpg and .jpeg format are accepted"

            );

        }

                

}

else{

    $arr = array(

    'status'=>1, 

    'message'=>"Please try Post Method"

    );

}



$arr[ 'api' ] = $api_version;

$arr[ 'time' ] = ( microtime(true) - $start );



print_r( json_encode( $arr ) );



?></code></pre>



<p>Image Folder with this file like</p>



<center>
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads" style="display:inline-block;" data-ad-client="ca-pub-3804472713147276" data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>



<figure class="wp-block-image"><img src="https://www.maxester.com/blog/wp-content/uploads/2020/07/php-volly-image1.jpg" alt="" class="wp-image-1019" srcset="https://www.maxester.com/blog/wp-content/uploads/2020/07/php-volly-image1.jpg 542w, https://www.maxester.com/blog/wp-content/uploads/2020/07/php-volly-image1-300x125.jpg 300w" sizes="(max-width: 542px) 100vw, 542px" /></figure>



<figure class="wp-block-image"><img src="https://www.maxester.com/blog/wp-content/uploads/2020/07/php-volly-image2.jpg" alt="" class="wp-image-1020" srcset="https://www.maxester.com/blog/wp-content/uploads/2020/07/php-volly-image2.jpg 561w, https://www.maxester.com/blog/wp-content/uploads/2020/07/php-volly-image2-300x110.jpg 300w" sizes="(max-width: 561px) 100vw, 561px" /></figure>



<center>
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads" style="display:inline-block;" data-ad-client="ca-pub-3804472713147276" data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2020/07/28/php-code-for-upload-image-to-server-using-volley-in-android/">PHP Code for Upload File/Image to the server using Volley in Android</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2020/07/28/php-code-for-upload-image-to-server-using-volley-in-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
