<?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>Windows Explorer &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/windows-explorer/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>Automatically Upload Images with PHP Directly from the URI</title>
		<link>/2010/09/10/automatically-upload-images-with-php-directly-from-the-uri/</link>
		<comments>/2010/09/10/automatically-upload-images-with-php-directly-from-the-uri/#comments</comments>
		<pubDate>Fri, 10 Sep 2010 06:49:54 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[automatic upload]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[Form]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[Mac OS X Server]]></category>
		<category><![CDATA[php tutorial]]></category>
		<category><![CDATA[php upload]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[web form]]></category>
		<category><![CDATA[Windows Explorer]]></category>
		<category><![CDATA[Windows Server]]></category>
		<category><![CDATA[World Wide Web]]></category>

		<guid isPermaLink="false">/?p=1973</guid>
		<description><![CDATA[It is a simple task to upload images on the server with PHP using a simple web form. Than everything&#8217;s in the $_FILES array and after submitting the form the file&#8217;s on the server. By simply move_uploaded_file you can change its location on the server to the desired folder. However is there a way to &#8230; <a href="/2010/09/10/automatically-upload-images-with-php-directly-from-the-uri/" class="more-link">Continue reading <span class="screen-reader-text">Automatically Upload Images with PHP Directly from the URI</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2011/01/18/download-images-with-php/" rel="bookmark" title="Download Images with PHP">Download Images with PHP </a></li>
<li><a href="/2011/02/25/how-to-collect-the-images-and-meta-tags-from-a-webpage-with-php/" rel="bookmark" title="How to Collect the Images and Meta Tags from a Webpage with PHP">How to Collect the Images and Meta Tags from a Webpage with PHP </a></li>
<li><a href="/2010/03/05/video-sites-must-use-mp4-and-only-mp4/" rel="bookmark" title="Video sites must use &#8230; mp4 and only mp4!">Video sites must use &#8230; mp4 and only mp4! </a></li>
<li><a href="/2009/04/23/when-you-should-use-base64-for-images/" rel="bookmark" title="When you should use base64 for images">When you should use base64 for images </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>It is a simple task to upload images on the server with PHP using a simple web form. Than everything&#8217;s in the $_FILES array and after submitting the form the file&#8217;s on the server. By simply move_uploaded_file you can change its location on the server to the desired folder.</p>
<p>However is there a way to &#8220;upload&#8221; files without using a web form, but only by telling the PHP script where to find the image. First and most important the image should be web visible and accessible by HTTP.</p>
<p>The solution is quite easy &#8211; you can grab the file using file_get_contents, and than put it on the desired server folder with file_put_contents. Here&#8217;s some source:</p>
<pre lang="php">$image = file_get_contents('http://www.example.com/image.jpg');
file_put_contents('/var/www/my.jpg', $image);
</pre>
<h2>Extending the Case</h2>
<p>You can go even further by downloading any kind of files with the same approach. What will be the case for an mp4 video is shown in the next example:</p>
<pre lang="php">$video = file_get_contents('http://www.example.com/video.mp4');
file_put_contents('/var/www/my.mp4', $video);
</pre>
<h2>Usage</h2>
<p>This can be quite useful when trying to automate an remote upload process. In this case when somebody uploads an image on his site, you can duplicate this file on your server! However don&#8217;t forget the <strong>copyrights</strong>!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2011/01/18/download-images-with-php/" rel="bookmark" title="Download Images with PHP">Download Images with PHP </a></li>
<li><a href="/2011/02/25/how-to-collect-the-images-and-meta-tags-from-a-webpage-with-php/" rel="bookmark" title="How to Collect the Images and Meta Tags from a Webpage with PHP">How to Collect the Images and Meta Tags from a Webpage with PHP </a></li>
<li><a href="/2010/03/05/video-sites-must-use-mp4-and-only-mp4/" rel="bookmark" title="Video sites must use &#8230; mp4 and only mp4!">Video sites must use &#8230; mp4 and only mp4! </a></li>
<li><a href="/2009/04/23/when-you-should-use-base64-for-images/" rel="bookmark" title="When you should use base64 for images">When you should use base64 for images </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/09/10/automatically-upload-images-with-php-directly-from-the-uri/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
<enclosure url="http://www.example.com/video.mp4" length="0" type="video/mp4" />
		</item>
	</channel>
</rss>
