Results 1 to 10 of 12
-
4th Mar 2011, 11:22 AM #1OPMember
Image Remote Upload Script
I'm having trouble making a script that will grab multiple images from urls then save it to the current directory where the script is located I don't need any design, just a script that will be able to do this. Here's what i'm expecting it to look like
Anyone knows how?
Hillside Reviewed by Hillside on . Image Remote Upload Script I'm having trouble making a script that will grab multiple images from urls then save it to the current directory where the script is located :( I don't need any design, just a script that will be able to do this. Here's what i'm expecting it to look like <3 http://lulzimg.com/i14/289633.jpg Anyone knows how? Rating: 5
-
4th Mar 2011, 11:28 AM #2It begins...
So you're going to input a set of image urls into the first text box, and when run the image will grab those images and save them to a specified directory, yes? What does the output box do? Echo the links of those images relative to the url specified in the script?
Also, is this going to be a private script? If yes, you can be a little relaxed in terms of security.
Post your current code here.
-
4th Mar 2011, 11:30 AM #3Retired NinJaWebsite's:
loledhard.comever heard about curl, Just chk Google for tuts. Curl can leech the image for u on ur server
You don't hate Justin bieber.You hate the fact you ain't Justin Bieber!
-
4th Mar 2011, 11:32 AM #4It begins...
dump curl, go for an easier solution if it's going to be private - file_get_contents and file_put_contents
-
4th Mar 2011, 01:07 PM #5You can call me G
okay telling it real quick!
get the urls from the textarea via POST. Explode them in an array.
then implement this logic..
Code:foreach($arr as $url){ $img = file_get_contents($url); file_put_contents("/path/to/file", $img); }
My Langotiya Yaars (Chaddi buddies): JmZ, humour, Chutad, Esotorisk, l0calhost, Daniel, Mind Freak?, TLK, Amz
-
4th Mar 2011, 01:10 PM #6OPMember
Oh no, what am i going to do with those php codes? my nose is bleeding.. I do not know what i'll do LoL
-
4th Mar 2011, 01:28 PM #7It begins...
This, is technically supposed to work:
PHP Code:<?php
$imgPath = "/home/admin/domains/xyz.com/folder/"; //path where images are to be located
$baseurl = "http://xyz.com/folder/images/"; //the base path for images as a url (refer below)
//so if your images are supposed to be at http://domain.com/img/xyz.jpg then your baseurl is 'http://domain.com/img/' (with trailing slash)
//essentially, both the above paths should have something in similar with regards to folder structure
echo '<form enctype="multipart/form-data" action="" method="POST">';
echo '<textarea rows="10" cols="50" name="urls"></textarea>';
echo '<input type="submit" name="submit" value="submit" />';
echo '</form>';
if (isset($_REQUEST['submit']))
{
$urls = explode("\n", $_POST['urls']);
$imgarray = array();
foreach ($urls as $url)
{
$url = trim($url);
$imgname = basename($url);
$localimg = $imgPath . $imgname;
$img = file_get_contents($url);
file_put_contents($localimg, $img);
$url = $baseurl . $imgname;
$echo "$img <br />";
}
}
?>
-
4th Mar 2011, 01:42 PM #8OPMember
Thank You! Works Great! Just Awesome..
edit: everything was going fine, but when i go to check the file, it says 404 not found because the new file now ends from sdfsd.jpg(original file) to sdfsd.jpg%20%0d. What's wrong?
-
4th Mar 2011, 01:45 PM #9It begins...
Just remember I'm not sanitizing filenames or checking for extensions or anything of that sort in the script, since you said it'd be for private use. So you're best off randomly naming it to prevent someone being able to type it in. It's not very secure, but it'll get the job done.
-
6th Mar 2011, 03:53 PM #10Banned
Hill if you make the script please PM me a copy
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Suggest a image host with remote zip upload
By Al3xs in forum Hosting DiscussionReplies: 2Last Post: 2nd Aug 2012, 03:31 AM -
Remote Upload Script 2011 (need help)
By apps.trader in forum Webmaster ResourcesReplies: 31Last Post: 16th May 2011, 02:54 PM -
PornBoxIt Adult Image upload/Remote + Add-ons for Firefox Fast And Easy
By PBI NetWork in forum Webmaster DiscussionReplies: 2Last Post: 6th Apr 2011, 07:30 PM -
Megaupload Remote upload script?
By illetyus2 in forum Technical Help Desk SupportReplies: 0Last Post: 12th Dec 2010, 12:48 PM -
RS to RS remote upload script
By Bose in forum Webmaster ResourcesReplies: 9Last Post: 14th May 2010, 03:23 AM
themaLeecher - leech and manage...
Version 4.94 released. Open older version (or...